Answer the question
In order to leave comments, you need to log in
Why are refs needed in ReactJS?
Not so long ago, I undertook to study ReactJS, but I ran into a misunderstanding. What are refs for ?
However, there may be situations where you need to imperatively change a child element, bypassing the normal data flow.
clipping from office documentation
Answer the question
In order to leave comments, you need to log in
In order to access the props of the child component from the parent or the state of the child component from the parent, or call the method of the child component from the parent.
I think it will be faster for you to google than to write to someone.
But if anything, then here it is .
Don't use ref if you can do without it. This feature should be used as infrequently as possible. After a while, you yourself will understand why this is needed, but for now, just skip and focus on the philosophy of react chapter.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question