O'Reilly logo

Hands-On Design Patterns with React Native by Mateusz Grzesiukiewicz

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Using Redux Thunk

In classic Redux, with no middleware, you cannot dispatch something that is not a pure object. With Redux Thunk, you can delay the dispatch by dispatching a function:

"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." - Redux Thunk official documentation, available at: https://github.com/reduxjs/redux-thunk.

For instance, you can dispatch a function. Such a function has two arguments: dispatch and getState. This function does not reach the Redux reducers yet. It only delays the ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required