What is a difference between action,reducer and store in redux?
·
Answer a question
I am new to react/redux. I am trying to figure out how all the pieces in redux interact. The one thing giving me trouble is understanding the relation between actions and reducers,store.
Answers
It's pretty simple when you think about it:
- Store - Is what holds all the data your application uses.
- Reducer - is what manipulates that data when it recieves an action.
- Action - is what tells reducer to manipulate the store data, it carries the name and (not required) some data.
Reducer is usually in a format of a switch statement, that switches between all possible Actions (Cases) and then manipulates the Store data based on action. When a reducer data changes within the redux, the properties in your components are changed and then the re-render ocurrs.
更多推荐
所有评论(0)