Dispatch an Action Event

Tell us what’s happening:

I am completely confused here, help!

Your code so far

const store = Redux.createStore(
  (state = {login: false}) => state

const loginAction = () => {
  return {
    type: 'LOGIN'

// Dispatch the action here:

let store.dispatch(actionCreator());
store.dispatch({ type: 'LOGIN' });

Your browser information:

User Agent is: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/67.0.3396.99 Safari/537.36.

Link to the challenge:

Hi Cyath!

Here you want to call dispatch on the action creator that was created for you. In this case, that action creator is loginAction(). What you’ve got so far is trying to create a variable and then trying to dispatch a disconnected action rather than using the action creator they provided you.

Take note of what they said in the description “the following lines are equivalent, and both dispatch the action of type LOGIN:”

store.dispatch({ type: 'LOGIN' });

They’re indicating that both lines separately accomplish the same end goal. actionCreator() is not a predefined function, it’s just a placeholder function they used to demo the functionality which is part of why your code is running into an error.

I hope this helps!

1 Like

Try using this :wink: