Tell us what’s happening:
I’m not really sure what I’m doing wrong here, am I calling the dispatch in the wrong area perhaps? new to redux and I’ve been stuck on this one since yesterday. I’m pretty sure its something simple I’m missing.
Your code so far
const defaultState = {
login: false
};
const reducer = (state = defaultState, action) => {
switch (action.type) {
case "LOGIN":
return {...state, login: true};
default:
return state;
}
store.dispatch(loginAction())
}
const store = Redux.createStore(reducer);
const loginAction = () => {
return {
type: "LOGIN"
}
};
Your browser information:
User Agent is: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_12_6) 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