Reputation: 109
I'm new to redux, and my task is to convert this redux actions into vuex.
Now, I just stumbled upon this block of code which seems to not have any context.
dispatch({
type: 'CONNECT_TO_NETWORK',
payload: userProfile[0],
type: 'Meta',
})
What does this mean?
and if anyone knows, what is the equivalent of that code into vuex
?
Upvotes: 0
Views: 72
Reputation: 536
dispatch tells redux store "data changed!" with "action"(in the code above, the action is "CONNECT_TO_NETWORK") and then dispatch gives new data to the store. The store updates the data. After that, all components which uses the updated state data re-renders.
Upvotes: 1
Reputation: 444
in that object type, is the unique identifier that is going to match one of the switch cases in your reducers, payload is just a convention with redux, is going to be the other parameters or additional info you need to change the state of the app
https://www.merixstudio.com/blog/vuex-vs-redux/
Upvotes: 1