I have made an counter app and using redux for state management, and working fine but i am confuse that how reducer function is getting the action data even we have not imported action function in reducer file.
Using following Architecture:
Here is ACTION file code:
export const inc = () => {
return{
type: "INCREMENT"
}
}
export const dec = () => {
return{
type: "DECREMENT"
}
}
and Here is reducer file code:
const InitialState = 0;
const changeNumber = (state = InitialState, action) => {
switch (action.type){
case "INCREMENT": return state + 1;
case "DECREMENT": return state - 1;
default: return state;
}
}
export default changeNumber;
Reducer file function have to two parameters state and action. Where current state value is 0 and action value is an object which is coming from action file but how?
and as you know also having store white hold the global state and using redux official document for this.

