How do I update parent state from a child component?
Pass a callback function from the parent to the child as a prop. The child calls it with the new data, the parent updates its state, and the new data flows back down as props to whoever needs it.
Verify This Answer
Cross-check this information using these trusted sources:
More FAQs in Managing UI Data in a Real React App: A Practical Walkthrough
In the component that owns it. Data needed by multiple components is lifted to their common parent. Data that changes over time lives in state; data passed from a parent is props. Derived values are computed during render, not stored.
No. The filtered list is derived from the full list and the search query. Compute it during render so it always stays in sync. Storing it in state creates duplication and the risk of the two going out of sync.
Data flows down from parent to child through props, and changes flow up from child to parent through callbacks. The parent owns the shared state and updates it, then the new data flows back down.
Still have questions?
Browse all our FAQs or reach out to our support team
