Skip to content

Instantly share code, notes, and snippets.

@johnptmcdonald
Last active July 31, 2019 02:36
Show Gist options
  • Save johnptmcdonald/a33d4affa57afe64099f4e22c78d10d4 to your computer and use it in GitHub Desktop.
Save johnptmcdonald/a33d4affa57afe64099f4e22c78d10d4 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

In-class

Tutorial

It seems that students have not yet covered redux middleware in any previous module, which is a prerequisite for learning about thunks.

Instructor Demo

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

Tutorial

@glebec
Copy link

glebec commented Jul 31, 2019

@johnptmcdonald this gist is currently public rather than unlisted, which means my fork of it also is public instead of unlisted. Could you switch this to being a secret gist? Thanks (& hope you are well!).

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