Session

Think Thunks

Redux is one of the go-to tools for managing state in React applications. Frequently we depend on asynchronous behavior like fetching data from an API to update state. Unfortunately, out of the box, Redux can only handle synchronous state changes. The Redux-Thunk package provides the missing link needed to dispatch functions that return promises as actions. A Thunk allows us to manage all the state changes needed to fetch data, show a loading spinner, and then display the new data by dispatching a single function.

We will briefly review the standard actions provided by Redux. Then we will move on to understand how Thunks let us build action flows with promise based asynchronous calls. I will demonstrate the code to create a React app using a Thunk to fetch and display data from an external API with loading spinners and error-handling built in.

Paul McConnell

Software Engineer Focused on JavaScript and Web Development

Saint Louis, Michigan, United States

View Speaker Profile

Please note that Sessionize is not responsible for the accuracy or validity of the data provided by speakers. If you suspect this profile to be fake or spam, please let us know.

Jump to top