welldone-software / 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.)
https://www.npmjs.com/package/@welldone-software/why-did-you-render
MIT License
11.24k stars 201 forks source link

This library should provide demo project #217

Closed Eliav2 closed 3 years ago

Eliav2 commented 3 years ago

This is quite a popular library and I just can't get it to work, so a demo project could help many of us debug why it does not work in these cases.

rosstroha commented 3 years ago

There is a sandbox link in the readme. Is there something more you're looking for? https://codesandbox.io/s/6vowz0w2wz?expanddevtools=1&file=/src/index.js

Eliav2 commented 3 years ago

how did I miss that?

Eliav2 commented 3 years ago

but hey, why it doesn't show rerender of not pure components?

vzaidman commented 3 years ago

For not pure components, you. need to subscribe manually:

Component.whyDidYouRender = true;