I am going through the redux section a third time because I am still struggling to wrap my head around it.
My question is about actions and Action Creators. If my action creator function is just going to return an action, why can’t I just use the action object in the first place? Isn’t it reduntant to create a function that returns an object, when I could just use the object in the first place?
for example, could this:
const loginAction = () => {
return {
type: ‘LOGIN’
}
};store.dispatch(
loginAction()
)
be replaced with this?
const store = Redux.createStore(
(state = {login: false}) => state
);const loginAction = {
type: login
}store.dispatch(
loginAction
)
Essentially I’m replacing a redux action creating function with an action object.