Skip to main content
InterviewHubPRO
Section Overview
Q301

Question 301 of 407

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

74%
React Core & Hooks (407 Qs)•Part 9: React Hooks Deep Dive (262 - 316)

Is that possible to use useImperativeHandle without forwardRef?

mid LevelCode ExampleHooks

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).