Hacker News new | ask | show | jobs
by lobster_johnson 4237 days 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.