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.2k stars 201 forks source link

Partially Working with React 18 + NextJS 13 #285

Open aktasmehmet opened 9 months ago

aktasmehmet commented 9 months ago

Hi,

I've been stuggling to make WDYR work with the stack of React 18.2.0 and NextJS 13.5.6 using App Router.

What I did so far is to inject the wdyr script in next.config.ts and somehow made it work.

But the problem is that, I couldn't get any logs besides the useState hook changes. I created similar components and scenarios as in the documents provided but couldn't trigger WDYR for the prop changes. What am I missing here?

next.config.js Screenshot 2024-01-05 at 12 06 08

wdyr.ts Screenshot 2024-01-05 at 12 06 59

Parent Component Screenshot 2024-01-05 at 12 07 44

ChildComponent