3 ms·
Naive solution: What if every child had an intermediate parent node, something like: <Transition current={this.state.mode}> <TransitionItem name="map
by lobster_johnson 12y ago
Naive solution: What if every child had an intermediate parent node, something like:
<Transition current={this.state.mode}>
<TransitionItem name="map">
<Map .../>
</TransitionItem>
<TransitionItem name="list">
<List .../>
</TransitionItem>
</Transition>
By making the possible children explicit, you can preserve them in the virtual DOM as long as is needed. The actual child (Map and List) would be mounted/unmounted only as needed.