I've tried make project with listing of cafes and markers in Google MAP their locations.
Idea is to click on place to select cafe and - get selcted appropriate markers and vice versa (click marker - get focused appropriate cafe in listing)
I have hierarhy of nested components like:
< App>:
<List>
<place1>
<place2>
....
<place10>
</List>
<Map>
<marker of place1/>
<marker of place2/>
...
<marker of place10/>
</Map>
</App>
I can make simple way just keep information which cafe selected in variable inside State of top parent - App.
But I dont want to fire rendering all this whole tree of components - its a lot work for browser.
I can keep focused value inside state of each child components placeX and markerX. So When I click some placeX is toggle to focused:true and send to next previous component to focused:false through function in parent- List. So - its just 2 child components going to re-render.
But how to fire changes in child components - in next branch: ?