I am just starting with NextJS and there is a new router called app router. Now I have some tutorials using pages/_app.js
from the NextJS page router. So, what’s the corresponding file for that in the app router?
I am just starting with NextJS and there is a new router called app router. Now I have some tutorials using pages/_app.js
from the NextJS page router. So, what’s the corresponding file for that in the app router?
2
Answers
Inside
app
each folder represent a route segment. The very first folder i.e app itself represent the root route segment.app/layout.js
will now be the equivalent for_app.js
in the new Next 13 app directory. Since, it is the one wrapping all route and sub routes of your whole app.there is not a corresponding file in
app
directory. this is whatpages/_app.js
used forI think if you create a context provider and use it in
RootLayout
like this