Tell us what’s happening:
the one error I am getting.
“Dispatching loginAction should update the login property in the store state to true.”
^
I’ve watched a few tutorials on Redux and they all mention payloads, how can I set my store.dispatch({type: loginAction to make my login property = true?
Your code so far
const defaultState = {
login: false
};
const reducer = (state = defaultState, action) => {
// change code below this line
if(action.type === 'LOGIN'){
return state;
}
return state
// change code above this line
};
const store = Redux.createStore(reducer);
const loginAction = () => {
return {
type: 'LOGIN'
}
};
store.dispatch({type: loginAction})
Your browser information:
User Agent is: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_13_4) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/66.0.3359.181 Safari/537.36
.
Link to the challenge:
https://learn.freecodecamp.org/front-end-libraries/redux/handle-an-action-in-the-store/