← React Intermediate Questions - Set 8 Q77

How can you pass data from a child component to a parent component in React?

React Intermediate Questions - Set 8

Example

function Child({ onChange }) {
  return <input onChange={e => onChange(e.target.value)} />;
}
// parent passes setter, child calls it

What to notice

← Back to the question list