How to decrease unnecessary re-renders
Fix your slow renders first. Then deal with the "unnecessary re-renders"
A React Component can re-render for any of the following reasons:
Its props change
Its internal state changes
It is consuming context values that have changed
Its parent re-renders
When our components are re-rendered even though no DOM updates were needed, we can optimize that component to be memoized via React.memo
.
Last updated
Was this helpful?