All Projects → theKashey → why-did-you-update-redux

theKashey / why-did-you-update-redux

Licence: other
Patch Redux to discover unnecessary re-renders

Programming Languages

javascript
184084 projects - #8 most used programming language

Why did you update

Compatible with any Redux version!

npm version

Why did you update is a function that monkeypatches Redux and notifies you in the console when potentially unnecessary re-renders occur driven by unnecessary updates from mapStateToProps, which means - your selectors, or memoization is not as good, as they should.

Fear not, why-did-you-update-redux will tell you which field is updated while it should not, so you can fix it.

Look at the report - something is wrong with minDate, and maxDate. With "proper" memoization applied - they should be equal to the previous values, that's the idea of memoization, but something went wrong. Could you please double check your code? (Just click on the function to jump straight into definition)

Setup

This library is available on npm, install it with: npm install --save why-did-you-update-redux or yarn add why-did-you-update-redux.

Usage

import 'why-did-you-update-redux'; 
// import before redux!

What's all, and it will remove itself from a production bundle, so you don't have to.

How it works

This is basically import 'beautiful-react-redux/check', see beautiful-react-redux for more information.

why-did-you-update-redux is based on memoize-state library - How I wrote the world’s fastest React memoization library

Example?

https://codesandbox.io/s/o4mrzr865

License

MIT

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].