While profiling a complex React application, you observe that a child component renders every time its parent renders, but the child's props haven't changed. What could you utilize to optimize the child component's re-renders?
- Enabling strict mode in React.
- React.memo for the child component.
- Using React.PureComponent for the parent component.
- Wrapping the child component with React.Fragment.
To optimize the child component's re-renders, you can use React.memo for the child component itself. This memoization technique ensures that the child component doesn't re-render when its props remain unchanged. Utilizing React.PureComponent for the parent won't directly address the issue with the child component.
Loading...