File tree Expand file tree Collapse file tree
packages/react-core/src/demos/examples/Tabs Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -19,23 +19,14 @@ import {
1919import DashboardWrapper from '../../examples/DashboardWrapper' ;
2020
2121export const GrayTabsDemo : React . FunctionComponent = ( ) => {
22- const [ activeTabKey , setActiveTabKey ] = React . useState ( 0 ) ;
23- const [ activeNestedTabKey , setActiveNestedTabKey ] = React . useState ( 10 ) ;
22+ const [ activeTabKey , setActiveTabKey ] = React . useState < string | number > ( 0 ) ;
23+ const [ activeNestedTabKey , setActiveNestedTabKey ] = React . useState < string | number > ( 0 ) ;
2424
2525 // Toggle currently active tab
26- const handleTabClick = ( _ : React . MouseEvent , tabIndex : string | number ) => {
27- if ( typeof tabIndex === 'string' ) {
28- return setActiveTabKey ( parseInt ( tabIndex ) ) ;
29- }
30- return setActiveTabKey ( tabIndex ) ;
31- } ;
26+ const handleTabClick = ( _ : React . MouseEvent , tabIndex : string | number ) => setActiveTabKey ( tabIndex ) ;
27+
3228 // Toggle currently active nested tab
33- const handleNestedTabClick = ( _ : React . MouseEvent , tabIndex : string | number ) => {
34- if ( typeof tabIndex === 'string' ) {
35- return setActiveNestedTabKey ( parseInt ( tabIndex ) ) ;
36- }
37- return setActiveNestedTabKey ( tabIndex ) ;
38- } ;
29+ const handleNestedTabClick = ( _ : React . MouseEvent , tabIndex : string | number ) => setActiveNestedTabKey ( tabIndex ) ;
3930
4031 const tabContent = (
4132 < Grid hasGutter >
You can’t perform that action at this time.
0 commit comments