toggleChildren()}
+ onClick={() => toggleExpansion(i)}
>
e.stopPropagation()}>
{item.document?.title}
@@ -58,15 +72,15 @@ const Toc = ({ index, depth, visible }: Props) => {
{hasChildren(item) && (
- {expanded ? (
+ {expanded[i] ? (
toggleChildren()}
+ onClick={() => toggleExpansion(i)}
/>
) : (
toggleChildren()}
+ onClick={() => toggleExpansion(i)}
/>
)}
@@ -77,7 +91,7 @@ const Toc = ({ index, depth, visible }: Props) => {