react-responsive-tabs icon indicating copy to clipboard operation
react-responsive-tabs copied to clipboard

Tab is selected but it is not applying a active class. i have to double click on tab

Open ShariqAteeq opened this issue 4 years ago • 1 comments

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); }} /> ); };

ShariqAteeq avatar Jul 26 '21 14:07 ShariqAteeq

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...

maslianok avatar Aug 11 '21 09:08 maslianok