Writing a React Table of Contents Component

Eyas
6 min readMar 11, 2022

Last year, I wrote about migrating this blog to Next.js. It ended up being a huge post, so I wrote a<TOC> React component to make it more navigable.

The bulk of the logic for this component is based on Emma Goto’s great examples in her “ How to build a table of contents in React”, with a few improvements worth discussing. If you haven’t yet, go read that post! Emma does a great job…

--

--

Eyas

Software Engineer living in Brooklyn, NY. MIT Computer Science S.B. ’13, M.Eng. ‘14. From Amman, Jordan. Interested in politics, current affairs, and technology