I can see action is from the loginAction function, but that function does not call reducer. I think the createStore method calls the reducer function, but without arguments passed. so what part of the code is passing action into reducer ( or how does reducer know that action=loginAction() )?
Hi @danCamalMan
following reduce logic can be confusing at first.
The loginAction function creates an action object when called(it returns it). The createStore method does not call the reducer, it only takes it as an argument, by which it would mold the reduce store. There is difference between myFunction and myFunction(). The first only refer to the function, the second will call it and have on its place the value it returns.
The reducer function defines the different actions and how the stored state is to be handled, based on the action passed. It doesnt know what actions you would pass, but it can only work with the ones it knows to handle. In the next challenges, you will see how when you work with the store, you will pass actions to the reducer. So far you only defined the store, actions etc. but you havent put them into use