thunk redux

PHOTO EMBED

Fri Aug 26 2022 16:37:27 GMT+0000 (Coordinated Universal Time)

Saved by @SamMrch #react.js

export const toggle=()=>{
    return dispatch=>{
        dispatch({
        type:'toggle'
    })
    }
}
content_copyCOPY

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.

https://www.google.com/search?q