Use nextjs to render a specific part of html page

Viewed 1463

I'm trying to use nextjs for just a part of my web-site.
The navbar already exists in other frameworks, not even react. i want to use nextjs in a <div id="nextjs_div">...</div>, ie. just a part of my website.

The problem is that nextjs renders a whole HTML page with head and body components. so what I want basically is to delete these components and render just one div that will be mounted in my page.

I tried to modify the page/_document but couldn't succeed.

Do you have an idea of how i can do this.

1 Answers

Next.js is a framework intended to create full pages and most likely not appropriate tool to use for creating a part of a page. You could use just React then.

If you can make an HTML from the navbar then you could insert it into Next.js project.

See Add HTML header to Document.js example

Related