DEV Community

Discussion on: [React] Passing State to a Sister Component

Collapse
 
emmanuelonah profile image
Emmanuel Onah

There are many ways to do that:

  1. State lifting(the one you described in this article)

  2. Render props pattern

  3. Functional children patter(this is when you inject a data as a parameter of a children props e.g children({state})

  4. Higher order component/context (note that behind the hood context uses higher order component)

But overall, the pattern you describe is enough in most cases. We call it state lifting pattern

Collapse
 
trevortx profile image
Trevor Vardeman

Great comment, thanks for pointing out the other options!