React · Junior · Question 9 of 75

How can a child component pass data to its parent?

Explanation

In React, data flows down and events flow up through functions: <Search onChange={setQuery} />, and the child calls props.onChange(value). Mutating props won't re-render the parent, and function components have no access to the parent instance.

Further reading

Problem with a question

React · Junior · question 9

Test yourself

Take the React · Junior quiz: questions and options are shuffled, and you get a review of your mistakes at the end.

Take this quiz