Class-39 Readings: Redux - Additional Topics
Class-39 Readings: Redux - Additional Topics
Table of Contents
Reading, Research, and Discussion
1. What’s the best practice for “pre-loading” data into the store (on application start) in a Redux application?
- pack the initalize async feching data func in action, then call it when component is mounted.
2. When using a thunk/async action that dispatches the actual action, which do you export from your reducer?
- export an function that runs the async call to fetch data. It will be caught by the middleweare, run it, then return the action obj to use is with the reducer.
Vocabulary Terms
middleware
:
- def: software that acts as a bridge between an operating system or database and applications, especially on a network.
thunk
:
- def: Redux Thunk middleware allows you to write action creators that return a function instead of an action. The thunk can be used to delay the dispatch of an action, or to dispatch only if a certain condition is met. The inner function receives the store methods dispatch and getState as parameters.
Additional Resources
Tutorial
Bookmark / Skim