How to disable event during a state change

0๐Ÿ‘

โœ…

I imagine that if your component does not render it will not trigger a rerender in your chart, you could wrap your chart in a new component and use React.memo with your condition to render or not the chart, but take to avoid rendering bugs with memo it would be your last option used for performance improvements.

React is VERY fast and there are so many things I can think of for you
to do with your time that would be better than optimizing things like
this

Kent C. Dodds
https://kentcdodds.com/blog/usememo-and-usecallback

๐Ÿ‘:0

If you are using a function Component you could use hooks like useMemo which prevent you from rendering certain child components from rerendering. If you are using a class component you could get use of life cycle shouldComponentUpdate

Leave a comment