react-responsive-tabs
react-responsive-tabs copied to clipboard
Tab is selected but it is not applying a active class. i have to double click on tab
const CommonTabs = ({ array, onChange, path }) => { const router = useRouter(); const { tab } = router.query;
const getTabs = () => {
return (array || []).map((content, index) => ({
title: content.title,
getContent: () => content.component,
key: index,
tabClassName: "tab",
panelClassName: "panel",
}));
};
return (
<Tabs
transformWidth={600}
items={getTabs()}
selectedTabKey= {tab}
onChange={(e) => {
router.replace(${path}?tab=${e});
onChange(e);
}}
/>
);
};
Can you try to remove this line router.replace(${path}?tab=${e});?
Does it work without it?
I think router.replace triggers full rerender and somehow messes everything up...