samedi 21 mars 2015

React TabView component - keep Tab component state while changing tab


I'm trying to build a ReactJS component that i will release as open source that manages tabs and allows to load other components into the tabs by either create a new instance of the tab component each time you click it or reusing the same component instance until the TabView is destroyed.


I managed to create the first part of the component, and it works, but unfortunately the tabs seems always to attempt to create a new Loader component (which is responsible for either reuse an instance or create a new one.).


In the demo the companies and home count (wich can be increased by clicking) should remain the same even after changing tab and coming back. I can't save the count to the parent component because the tab will contain other complex controls and I can't keep passing the state to the parent.


How can I solve my problem? At the moment i'm saving the instance into a state property and reuse it, but it seems to not work. :/


Thanks for any futher help!


Source code: http://ift.tt/1HhQv6k Online demo: http://ift.tt/1MYUJOK





Aucun commentaire:

Enregistrer un commentaire