I am in the process of developing a website that features a table of contents with links on the left side, content sections in the middle, and an overview on the right. For a visual representation of the general concept, please visit: https://i.sstatic.net/1uf4P.png
Currently, all code is contained within one function:
import React from 'react';
import styles from '../styles/Home.module.css'
import table_of_contents from './test.js'
export default function Home() {
return (
<div className={styles.grid_container}>
... (code omitted for brevity)
)
}
I am seeking to make the
<div className={styles.left_pane}>...</div>
section reusable as it needs to be rendered for each link in the document for navigation purposes. However, due to my limited understanding of Nextjs/js/CSS, I am uncertain about the optimal way to structure this.
In an attempt to achieve reusability, I created another JavaScript file and defined a new function:
import React from 'react';
import styles from '../styles/Home.module.css'
export default function table_of_contents () {
return (the div here)
Unfortunately, I encountered difficulties getting it to render properly.
Any advice on how I can accomplish this effectively?