enhance React Hooks API
useReducer
can use middleware.
// use yarn
yarn add use-reducer-middlewares
// use npm
npm install use-reducer-middlewares
import useMiddleWares from 'use-reducer-middlewares'
import logger from 'redux-logger'
const reducer = function (state, action) {
// reducer
return state
}
const init = function(count) {
return {count}
}
const [state, dispatch] = useMiddleWares(reducer, 1, init)([
logger
]);
(Code Sandbox Demo)[https://codesandbox.io/s/wk3o2jp1ll]