You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
As for Redux, middleware is a way to extend Redhooks with custom functionality.
217
-
Middleware are functions which receive Store's `dispatch` and `getState` as named arguments, and return a function.
217
+
Middleware are functions which receive Store's `dispatch` and `getState` as named arguments, and return a function. Redhooks supports the use of the redux's middlwares like `redux-thunk`, `redux-saga` or you migth write a custom middlware conforming to middleware API.
218
+
219
+
## Custom middlware - Logger Example
220
+
221
+
```js
222
+
constlogger=store=>next=>action=> {
223
+
console.log('dispatching', action)
224
+
let result =next(action)
225
+
console.log('next state', store.getState())
226
+
return result
227
+
}
228
+
```
218
229
219
230
## Use `redux-thunk` and `redux-saga`
220
231
@@ -253,15 +264,17 @@ App routing can be handled using [React Router](https://github.com/ReactTraining
0 commit comments