why-did-you-render

why-did-you-render by Welldone Software monkey patches React to notify you about potentially avoidable re-renders. (Works with React Native as well.)

MIT License

Downloads
1.8M
Stars
10.8K
Committers
37

Bot releases are hidden (Show)

why-did-you-render - Improved how we detect if a component is functional or class components

Published by vzaidman almost 6 years ago

why-did-you-render - Using WeakMap instead of Map

Published by vzaidman almost 6 years ago

thanks @spiral2k for the idea

why-did-you-render - Monkey patches functional components using functional component and not a class

Published by vzaidman almost 6 years ago

This helps us to patch functional components "less" and prepares us for React Hooks.

why-did-you-render - Monkey patch "render" instead of "componentDidUpdate"

Published by vzaidman almost 6 years ago

In Next.js and we assume in other complicated cases, for some reason, inheritance of Component from another Component that inherits from React, doesn't work. Monkey patching render from the other hand does works.

Tested on a complex next.js project.

why-did-you-render - Fixed for inline render functions

Published by vzaidman almost 6 years ago

Turns out some libraries use render like this:

render = () => {

This means they don't have render in their class prototype.

This version can handle it just right.

why-did-you-render - Added the option to use "customName"

Published by vzaidman almost 6 years ago