InterviewHubPRO
Section Overview
Q301

Question 301 of 445

Part 9: React Hooks Deep Dive (262 - 316)

68%
React & Modern Frontend (445 Qs)•Part 9: React Hooks Deep Dive (262 - 316)

Is that possible to use useImperativeHandle without forwardRef?

No. useImperativeHandle only works when the component is wrapped in forwardRef. It's the combination that allows parent components to use a ref on a function component.

Practical Code Example

jsx
// Is it possible without forwardRef?
// In React 19: YES! 'ref' is passed as a standard prop in React 19.
// In React 18: Requires wrapping component in forwardRef(Component).