Thunks are a popular way to avoid directly causing side effects in our actions, action creators, or components, thus allowing us to keep the rest of our application pure (easier to test, reason about, re-use). Thunks are the simplest way to deal with AJAX requests in a redux application.
Students will understand the need to isolate side-effects to a particular stage of the redux cycle.
Students will be able to integrate the redux-thunk libary into a redux application and use it to make AJAX requests.
- It seems that students have not yet covered redux middleware in any previous module, which should be a prerequisite for learning about thunks. If this is correct, students should cover this in the pre-tutorial:
The instructor will demo the use of thunks in a sample application based upon the following codebase and accompanying video lecture: