use-reducer-logger
A very very basic logger for the useReducer
function in the React Hooks API. Inspired by redux-logger.
Usage
- Install with
npm install use-reducer-logger --save-dev
oryarn add use-reducer-logger -D
- Import logger with
;
- Wrap your reducer with logger before passing it to
useReducer
const state dispatch = ;
See Example
In a Dev Environment
You should only use this in a dev
environment. So you could do something like this to apply the logger based on the env
.
{ } const state dispatch = processenvNODE_ENV === 'development' ? : reducer initialState;
License
MIT see LICENSE
.
Contributing
Contributions are welcome.