Loading

Quipoin Menu

Learn • Practice • Grow

Direction: Choose the correct option

Q1.

What is React.memo?
A. A hook for memoizing values
B. A higher-order component that memoizes a functional component to prevent unnecessary re-renders
C. A method to memoize class components
D. A built-in component
Direction: Choose the correct option

Q2.

When does a component wrapped with React.memo re-render?
A. Only if its props change (shallow comparison)
B. Always
C. When its parent re-renders
D. Never
Direction: Choose the correct option

Q3.

Can React.memo be used with class components?
A. No, it's for functional components; class components use PureComponent
B. Yes, but only with memo()
C. No, it only works with hooks
D. Yes, with React.memo(MyClass)
Direction: Choose the correct option

Q4.

How can you customize the comparison in React.memo?
A. Pass a custom comparison function as the second argument
B. It's not customizable
C. Override shouldComponentUpdate
D. Use useMemo inside
Direction: Choose the correct option

Q5.

What is a common pitfall with React.memo?
A. It cannot be used with children
B. It breaks state updates
C. It always improves performance
D. It may cause bugs if props include functions that are recreated each render