Last active
September 20, 2023 08:02
-
-
Save FMCorz/b2d2f4cf6839c4f7402fecd32c84b680 to your computer and use it in GitHub Desktop.
ReactStrap Tabs using React hooks
This file contains 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
import React, { useState } from 'react'; | |
import { Nav, NavItem, NavLink, TabContent, TabPane } from 'reactstrap'; | |
export default function MyTabs(props) { | |
const [activeTab, setActiveTab] = useState('1'); | |
return ( | |
<div> | |
<Nav tabs> | |
<NavItem> | |
<NavLink className={activeTab == '1' ? 'active' : ''} onClick={() => setActiveTab('1')}> | |
Tab 1 | |
</NavLink> | |
</NavItem> | |
<NavItem> | |
<NavLink className={activeTab == '2' ? 'active' : ''} onClick={() => setActiveTab('2')}> | |
Tab 2 | |
</NavLink> | |
</NavItem> | |
</Nav> | |
<TabContent activeTab={activeTab}> | |
<TabPane tabId="1">Tab 1 Content</TabPane> | |
<TabPane tabId="2">Tab 2 Content</TabPane> | |
</TabContent> | |
</div> | |
); | |
} |
How to update the content of the table whenever the content changes?
thanks
Thank you, can I use your code for both production and personal usage ?
@jasurkurbanovinit Yes, of course!
Thanks Pro
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
thanks a lot