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.32k stars 199 forks source link

`trackAllPureComponents: true` is not working #294

Open Sheikh45 opened 8 months ago

Sheikh45 commented 8 months ago

Functional Component in React.Memo(Component) is not working, no logs or anything shows.

import React from 'react';

if (process.env.NODE_ENV === 'development') {
  const whyDidYouRender = require('@welldone-software/why-did-you-render');
  whyDidYouRender(React, {
    trackAllPureComponents: true,
  });
}

and importing it as first line in index.js

import './wdyr';
import React from 'react';

I am using CRA v5.0.1 and react v18.2.0 while the WDYR is v8.0.1 as devDependency

skanehira commented 3 months ago

same as...

alexandre-emmanuel commented 2 months ago

Same here. I am developing React 18.2 web app (using Redux, Material UI, AgGrid) and I am creating functional components only and no any wdyr message in the console. I have also downloaded official code sanbox, put React 18 into it (and added sass module explicitly) and tried to run on the localhost - but no wdyr messages either. I wonder - anyone is using wdyr at all? They should, because there are no alternatives, React DevTools Profile is too un-informative.