Tell us what’s happening:
Hello world!
I’m having an issue where I’m completely stuck.
The tests say that my code isn’t updating the state at the right time, nor is it initialising the state to login: false
.
Any help will be appreciated!
Your code so far
const defaultState = {
login: false
};
const reducer = (state = defaultState, action) => {
// change code below this line
if (action.type = "LOGIN"){
console.log(Object.assign({}, state, {
login: true
}), state )
return Object.assign({}, state, {
login: true
})
}
console.log("Keeping the old state of ", state)
return state
// change code above this line
};
const store = Redux.createStore(reducer);
const loginAction = () => {
return {
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: