welldone-software/why-did-you-render
View on GitHubShow line where hook that changed is used (feature request)
Open
#191 opened on Apr 27, 2021
enhancementgood first issuehelp wanted
Description
I currently have a very big hook, with dozens of useStates, lots of them have empty arrays which trigger unncesary re-renders. But I don't know which is the one doing it each time wdyr logs it's output. I get:
Re-rendered because of hook changes:
[hook useState result]
...diff
When would be very useful for me is:
Re-rendered because of hook changes:
[hook useState result] (someRandomHook.ts:34)
...diff
Knowing which hook is changing would be useful, specially in nested hooks scenarios, for example I have a hook which uses a hook, and that internal one has state, but wdyr does not even specify which hook is that useState from (I guess react makes no distinction, it only cares about hook declaration order, so not sure how possible would this feature request be.)