Is there an implementation of router Outlet in next.js or similar ? I want to render child components on the same page using sub-routes, but I haven’t been able to find anything for next.js that does the same.
Is there an implementation of router Outlet in next.js or similar ? I want to render child components on the same page using sub-routes, but I haven’t been able to find anything for next.js that does the same.
2
Answers
you can use something like this,
app/layout.js
app/dashboard/layout.js
Since you’re not using Next.js 13+’s "app directory" there is no native way of handling templates/layouts. Instead you have to create your own layout system
Here’s an example:
Don’t take this example literally, in a real-world scenario you would use dynamic router like
[id].js
.