Update Tabs.md
The function name and argument were wrong, probably remains of some old version. If you update this code also on the CodePen project, it will print to the console, like intended
This commit is contained in:
@ -45,7 +45,7 @@ const TabItem = props => <div {...props} />;
|
|||||||
const Tabs = ({ defaultIndex = 0, onTabClick, children }) => {
|
const Tabs = ({ defaultIndex = 0, onTabClick, children }) => {
|
||||||
const [bindIndex, setBindIndex] = React.useState(defaultIndex);
|
const [bindIndex, setBindIndex] = React.useState(defaultIndex);
|
||||||
const changeTab = newIndex => {
|
const changeTab = newIndex => {
|
||||||
if (typeof onItemClick === 'function') onItemClick(itemIndex);
|
if (typeof onTabClick === 'function') onTabClick(newIndex);
|
||||||
setBindIndex(newIndex);
|
setBindIndex(newIndex);
|
||||||
};
|
};
|
||||||
const items = children.filter(item => item.type.name === 'TabItem');
|
const items = children.filter(item => item.type.name === 'TabItem');
|
||||||
|
|||||||
Reference in New Issue
Block a user