Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

What's the alternative to pages/_app.js in app router in NextJS? [duplicate]

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?

like image 531
stefan.at.wpf Avatar asked Jan 28 '26 21:01

stefan.at.wpf


1 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.

like image 136
Badal Saibo Avatar answered Jan 30 '26 15:01

Badal Saibo