Answers for "what does redux thunk do?"

2

redux-thunk

npm install --save redux-thunk
Posted by: Guest on April-25-2020
1

redux thunk

import { createStore, applyMiddleware } from 'redux';
import thunk from 'redux-thunk';
import rootReducer from './reducers/index';

// Note: this API requires redux@>=3.1.0
const store = createStore(rootReducer, applyMiddleware(thunk));
Posted by: Guest on June-10-2021
0

what is redux thunk

Redux Thunk is middleware that allows you to return functions,
rather than just actions, within Redux. 
This allows for delayed actions, including working with promises.

---
One of the main use cases for this middleware is 
for handling actions that might not be synchronous, 
for example, using axios to send a GET request. 
Redux Thunk allows us to dispatch those actions asynchronously 
and resolve each promise that gets returned.
Posted by: Guest on December-13-2021

Code answers related to "Shell/Bash"

Browse Popular Code Answers by Language