← React Intermediate Questions - Set 4 Q36
How can you prevent a component from re-rendering in React?
React Intermediate Questions - Set 4
Example
1
2
const Heavy = memo(function Heavy({ data }) { … });
const data = useMemo(() => build(), [source]);
What to notice
- Memoise the component and stabilise its props; nothing else prevents a parent-driven render.
← Back to the question list