diff --git a/src/components/UI/docs/DocsLinks.tsx b/src/components/UI/docs/DocsLinks.tsx index f743850bcb..014291746b 100644 --- a/src/components/UI/docs/DocsLinks.tsx +++ b/src/components/UI/docs/DocsLinks.tsx @@ -41,14 +41,16 @@ export const DocsLinks: FC = ({ navLinks, toggleMobileAccordion }) => { ) ); }, [asPath, navLinks]); + + const handleSectionToggle = (id: string): void => { + setOpenSections(prev => ({ ...prev, [id]: !prev[id] })); + }; + return ( {navLinks.map(({ id, to, items }, idx) => { const split = to?.split('/'); const isActive = slug && split && split[split.length - 1] === slug[slug.length - 1]; - const handleToggle = () => { - setOpenSections(prev => ({ ...prev, [id]: !prev[id] })); - }; return ( @@ -62,7 +64,7 @@ export const DocsLinks: FC = ({ navLinks, toggleMobileAccordion }) => { placeContent='flex-end' bg='button-bg' data-group - onClick={handleToggle} + onClick={() => handleSectionToggle(id)} >