Problem Statement
How can you pass data between React components (parent → child and child → parent)?
Explanation
Pass data from parent to child via props. To send data back up, pass a callback function from the parent and invoke it in the child with new data.
Code Solution
SolutionRead Only
// Parent
<Child onSave={setValue} />
// Child
props.onSave('updated');Practice Sets
This question appears in the following practice sets: