javascript - How to communicate between two siblings components without changing state of parent? -
i new reactjs , faced following problem - have parent component, , 2 child components - list , map. both of these has children items. want when hover component in map - change style of appropriate component in list , vice versa. can handle hover events, if save id of hovered element in parent state, rerender full parent component on each hover. how can avoid this? i'm not using redux or this.
no, won't.
it rerender elements have changed.
, don't worry - o(n) extremely fast. pointed out in comments, if component extremely large - implement intermediate 1 well.
here how react implements diff algorithm.
rerender in case of:
- different node types
- key attribute changed
Comments
Post a Comment