0

I'm a react JS developer and trying to create nested childrens in nextjs. In react i used the outlet to nest the child components but how can i nest child in next js.

Folder Structure:

https://i.stack.imgur.com/IF32k.png

Index.js:

https://i.stack.imgur.com/w1v8U.png

As you can see the indexpage, there is a navbar. When i click on about it change the route. But i don't want to change the route. I want to render the content of about on the same page under the navbar. And on on click of projects and blogs i want to change the route and on that route i want different navbar not like the index.js navbar.And on blog page i want a sidebar which containes links whenever i click on specific link the specific page will render on right of sidebar (outlet thing). I'm new to it is there a way to do this

I gone through the documentation and also read articles on it. Is there a way nest child components in a parent layout.

Sohaib Butt
  • 57
  • 1
  • 8

1 Answers1

0

move about.js outside pages folder, and import it on the page you want to render it, you can set in state, when user click about and render the about page

Nikhil bhatia
  • 1,297
  • 1
  • 8
  • 9