Answer the question
In order to leave comments, you need to log in
Is it possible to call a method on a child component from a parent?
For example, there is a parent component that returns children through this.props.childern
Is it possible to somehow call the method that is described in the child component from the method of the parent component?
For example, in the method of the Wrap component, call the method of the Item component
<Wrap>
<Item/>
</Wrap>
Answer the question
In order to leave comments, you need to log in
I think no. You can forward a method from a parent component to a more nested (child) component via props. I believe that you can solve the problem either by using Redax. Or wrap the components you specified in another one and it will be a parent for them, write a method in it and pass it through the props.
If, of course, I understood the question correctly. Here is an article about this https://habr.com/en/post/436702/
Maybe you are doing something wrong? In my experience, there were no such situations - most likely you can solve your problem without crutches, having risen to a higher level.
Describe the situation more broadly - there is a solution without calling child methods.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question