Módulo 23 de 28 · Diagrama de flujo
React siblings components
Connecting siblings components
What if we want to pass data through components who are siblings? And not parent and children? Then the solution is to initialize and maintain state to a common parent component of both siblings.
Since they are siblings, they should share a parent component! Then they can both have access to the state of the parent component, passed as props.
Already confused? Let’s see an example!