Redux Flashcards
1
Q
What is the first principle of Redux?
A
A Single Source of Truth: The single immutable state tree. The whole state of your application is stored as a single JavaScript object.
2
Q
What is an action in Redux?
A
- Actions are payloads of information that send data from your application to your store.
- They are the only source of information for the store.
- Actions are plain JavaScript objects.
- Actions must have a type property that indicates the type of action being performed.
3
Q
What is the second principle of Redux?
A
State is Read-Only: The only way to change the state is to emit an action, an object describing what happened.
4
Q
What is the third principle of Redux?
A
Changes are made with pure functions: To specify how the state tree is transformed by actions, you write pure reducers.
5
Q
What is a reducer in Redux?
A
Reducers are just pure functions that take the previous state and an action, and return the next state.