What is useImperativeHandle?

React refs, context and custom hooks · Freshers and experienced

Model answer

It customises what a ref exposes to the parent. Instead of giving the parent the whole DOM node, you expose a small API such as { focus, reset }. It is rarely needed and is a last resort: prefer props and state for communication.

Learn this topic

React Context API Explained: Share Data Without Passing Props in the course React.js Full Course: Beginner to Advanced.

Sign in to add your own answer.

More questions