Loading

Quipoin Menu

Learn • Practice • Grow

react / useCallback Hook
mcq
Direction: Choose the correct option

Q1.

What is the useCallback hook used for?
A. To create refs
B. To memoize functions so they are not recreated on every render
C. To handle side effects
D. To memoize values
Direction: Choose the correct option

Q2.

How is useCallback different from useMemo?
A. They are the same
B. useCallback is for state
C. useMemo is for functions
D. useCallback memoizes functions, useMemo memoizes values
Direction: Choose the correct option

Q3.

Why would you use useCallback?
A. To prevent unnecessary re-renders of child components that rely on function props
B. To optimize expensive calculations
C. To handle events
D. To update state
Direction: Choose the correct option

Q4.

What does useCallback return?
A. A ref
B. The memoized function
C. The memoized value
D. A new function each time
Direction: Choose the correct option

Q5.

Which dependency array is correct for useCallback to ensure the callback always uses the latest state?
A. No dependencies
B. Include only functions
C. Empty array
D. Include all state/props that the callback uses