You can simply pass the middlewares in the comma separated manner like the following code: const store = createStore(reducer, applyMiddleware(thunk, logger)); Note: Please import the applyMiddlware, thunk, and logger at the top.
Read moreWhat is logger middleware in Redux?
It provides a third-party extension point between dispatching an action, and the moment it reaches the reducer . People use Redux middleware for logging, crash reporting, talking to an asynchronous API, routing, and more.
Read moreWhat is Redux logger?
LogRocket is a production Redux logging tool that lets you replay problems as if they happened in your own browser . Instead of guessing why errors happen, or asking users for screenshots and log dumps, LogRocket lets you replay Redux actions + state, network requests, console logs, and see a video of what the user saw.
Read moreWhy do we need 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.
Read moreWhat is the use of Applymiddleware?
Middleware lets you wrap the store’s dispatch method for fun and profit . The key feature of middleware is that it is composable. Multiple middleware can be combined together, where each middleware requires no knowledge of what comes before or after it in the chain.
Read moreWhy is it called a thunk?
The term originated as a whimsical irregular form of the verb think . It refers to the original use of thunks in ALGOL 60 compilers, which required special analysis (thought) to determine what type of routine to generate.
Read moreHow do you use thunk?
A ‘thunk’ is a concept that can help with this situation.
Read more