Answer the question
In order to leave comments, you need to log in
How to pass something from a child component to a parent component in React?
I can not understand how to correctly implement the task.
There is a Home
page
and there is a component inserted button
In Home created a variable counter = 0
I want the button to do counter++ and return the data back to Home
Answer the question
In order to leave comments, you need to log in
In Home, describe the function to change counter. And pass through the props to the button component. In button hang this props on onClick event
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question