Replies: 1 comment
-
Closing due to in-activity, Note: React 19 will allow us to pass refs as props, we will publish a blog on our React 19 plans, shortly |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Always forward ref to root element of a component, which expose DOM element to parent.
For components that requires exposing additional DOM element for ease of use, e.g. Input's nested
input
, add additional ref prop with name matching underlying DOM element. E.g.inputRef
in Input,textAreaRef
in MultilineInput.If the component needs additional ref to control element internally, create a ref and use
useForkRef
to connect it with ref passed inThis also means we are not encouraging imperative handlers. If there is a requirement, consider using additional props instead.
Beta Was this translation helpful? Give feedback.
All reactions