Problem Statement
Which hook helps prevent unnecessary re-renders of components in React Native?
Explanation
useMemo caches the result of a function between renders so it only recalculates when dependencies change.
It prevents expensive operations from running unnecessarily, improving performance during re-renders.
Code Solution
SolutionRead Only
const value = useMemo(() => computeExpensiveValue(a, b), [a, b]);
Practice Sets
This question appears in the following practice sets: