Here is the toc component
Let's break down the parts of the BlogTableOfContents component that are used to sync the scroll of the collapsed table of contents (TOC) with the scroll of the page, ensuring that the current element is always in view.
headings
: Stores an array of heading objects with their ids and indexes.activeId
: Keeps track of the currently active heading id.tocCollapsed
: Manages the collapsed state of the TOC.