Hello,
Dispatch an Action Event
In this lesson we learn dispatch() methode to send the action to the store. But in the next exercises we don’t use dispatch() anymore. In the next one for exemple, here is the code:
Handle an Action in the Store
const defaultState = { // state de départ
login: false
};
const reducer = (state = defaultState, action) => { // le reducer qui est chargé de modifier le state, on lui transmet donc le state de départ.
// Change code below this line
if (action.type === "LOGIN") {
return {
login: true
}
} else {
return state
}
// Change code above this line
};
const store = Redux.createStore(reducer); // la création du store
const loginAction = () => { // l'action a transmettre
return {
type: 'LOGIN'
}
};
Why loginAction is not send by dispatch ?
I would like understand why dispatch is not used.