Answer the question
In order to leave comments, you need to log in
How to pass a ref to a child component?
You need to pass a ref to a child component in a functional component, with such a transfer, an error at random , tell me if it is possible to somehow transfer it to a functional component or you need to use a class one, the official documentation says that you can’t transfer it in a functional component, but suddenly someone could)
Answer the question
In order to leave comments, you need to log in
On the first render ref.current === null
Yes, and not a ref is needed here, but useState. You can’t cook porridge with a ref, there will be no updates, it is used for something else.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question