Before we end this chapter, let's test our knowledge with some questions:
- When implementing an action object, how many properties can it contain?
- Why did we need Redux Thunk in our Redux store?
- How did we make the state in our store read-only?
- In the questionsReducer function we implemented, why didn't we use the array push method to add the new question to the state?
case 'PostedQuestion': {
return {
...state,
unanswered: action.result
? (state.unanswered || []).push(action.result.question)
: state.unanswered,
postedResult: action.result,
};
}
- Does the Provider component from React Redux need to be placed at the top of the component tree?
- As well as the Provider component, what is the other item from React Redux that allows a component to consume data from the Redux store?
- Is a component that consumes the Redux store allowed to have...