Skip to content

Instantly share code, notes, and snippets.

@glebec
Forked from johnptmcdonald/module-030-Thunks.md
Last active July 10, 2019 00:46
Show Gist options
  • Select an option

  • Save glebec/51a4cecabf0bb7d15f8fe8f5946263b4 to your computer and use it in GitHub Desktop.

Select an option

Save glebec/51a4cecabf0bb7d15f8fe8f5946263b4 to your computer and use it in GitHub Desktop.

Thunks

Needs Statement

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.

Objective

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.

Prework

Pre-reading

Pre-tutorial

  • 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:

In-class

Instructor Demo

The instructor will demo the use of thunks in a sample application based upon the following codebase and accompanying video lecture:

Tutorial

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment