Last active
May 2, 2017 18:48
-
-
Save darklilium/08f5a1ea92b00c6fac53cd560d6f031d to your computer and use it in GitHub Desktop.
React Tabs component
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| /*The tab component doesnt work too well when u try to render it. | |
| https://github.com/reactjs/react-tabs | |
| Thanks to : deepaksisodiya | |
| "Removing the selectedIndex={0} is not a solution, | |
| You need to set it by state, like | |
| selectedIndex={this.state.selectedTab} | |
| also initialise selectedTab state to your preferred tab. | |
| then on onSelect={this._handleSelect} event of Tabs, set the selectedTab again. | |
| */ | |
| _handleSelect = (index, last) => { | |
| console.log('Selected tab: ' + index + ', Last tab: ' + last); | |
| this.setState({ | |
| selectedTab: index | |
| }); | |
| }; | |
| // by doing this, on tab it will not move to another tab by click event :)" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment