Redux Flashcards
1
Q
Tell me what you know about actions and how they work.
A
- Actions are the only way view components communicate changes to the store.
- Actions are POJOs with a mandatory “type” key, and optional payload keys containing new data.
- Actions and action creators are dispatched to move along in the Redux loop.
- Use action creators when dealing with dynamic data. They are functions that return a POJO, or an action.
Insider Tip: 5. export const string literal action types to raise error in Reducer if misspelled action. (i.e. export const ADD_FRUIT = "ADD_FRUIT"; export const ADD_FRUITS = "ADD_FRUITS"; export const SELL_FRUIT = "SELL_FRUIT"; )
2
Q
Store?
A
// store is a POJO that holds the global state of application // Store is responsible for: 1. updating app state via reducers 2. shares state to the apps view layers 3. listen to actions?