Problem Statement
What causes unnecessary re-renders and how do you prevent them?
Explanation
Unnecessary re-renders happen when state or props change unnecessarily, or when functions or objects are recreated each render. Prevent them using React.memo, useMemo, useCallback, and by avoiding direct mutations of state.
Practice Sets
This question appears in the following practice sets: