redux-log-slow-reducers
Version:
Warn about slow reducers used in your redux app.
43 lines (31 loc) • 1.81 kB
Markdown
[][]
===========================
[](https://www.npmjs.com/package/redux-log-slow-reducers)
[](https://www.npmjs.com/package/redux-log-slow-reducers)
[](https://www.npmjs.com/package/redux-log-slow-reducers)
[](https://codeclimate.com/github/michaelcontento/redux-log-slow-reducers)
Warn about slow reducers in your [Redux][] app.
npm install --save redux-log-slow-reducers
```js
// Import all your reducers as usual
import * as reducers from './reducers';
// And simply wrap it with the function exposed by this module
//
// Note: There is a optional second argument to logSlowReducers which allows you
// to define how slow a reducer must be to trigger a warning (in ms). The
// default value for this is currently 8ms, as this is half the time
// available in one frame to run at 60fps.
import logSlowReducers from 'redux-log-slow-reducers';
const loggingReducers = logSlowReducers(reducers);
// Everything else is plain redux stuff
import { createStore, combineReducers } from 'redux';
const store = createStore(combineReducers(loggingReducers));
```
- Write tests for everything!
[]: https://github.com/gaearon/redux
[]: https://github.com/michaelcontento/redux-log-slow-reducers
[]: https://facebook.github.io/react-native/
[]: https://facebook.github.io/react-native/docs/netinfo.html#content