Question · JavaScript and React course · Module 9: Modern React Hooks
React.memo with Custom Comparator
What is the purpose of the second argument (custom comparator) in React.memo(Component, compareFn)?
Answer options
- It allows defining custom props comparison logic to control when the component re-renders
- It sorts props alphabetically before passing them to the component
- It automatically memoizes all component props in a cache
- It forces deep object comparison instead of referential comparison
You can check the correct answer by solving this task in the CodeWorlds game.