score:0

Accepted answer

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

score: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


Related Query

More Query from same tag