Skip to content

Latest commit

 

History

History
42 lines (34 loc) · 1.16 KB

File metadata and controls

42 lines (34 loc) · 1.16 KB

Re-renders

yarn add --dev @babel/preset-react @welldone-software/why-did-you-render
  • index.js
  • wdyr.js
  • babel.config.js
  • patches/@welldone-software+why-did-you-render+7.0.1.patch
  • Component.whyDidYouRender = true;



  • pure components
    • React.memo
    • React.PureComponent
  • eliminate inline styles, callbacks, RegExp, Date
  • memoization hooks
  • split into separate components
  • React state batch update
  • ESLint
    • react-hooks/rules-of-hooks
      1. Hooks can only be called inside React function components.
      2. Hooks can only be called at the top level of a component.
      3. Hooks cannot be conditional.
    • react-hooks/exhaustive-deps