<Link> not working when using _app.js instead of index.js #14192
-
Hey All Hoping someone can point me into the right direction for this issue. I am using next to build a web application. Since i am using some custom css, I created an _app.js file over the regular index.js file. As a result the link routing does not seem to be working . I tested the same routes when using index.js as my home page and the routes worked. Is there a way to work around this without switching back to index.js? My file structure is the way its suppose to be. All pages in /pages dir. thanks for any help!!! |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 1 reply
-
Hi @david-Khayutin!
|
Beta Was this translation helpful? Give feedback.
Hi @david-Khayutin!
_app.js
is not a replacement forindex.js
._app.js
is a helper file that is useful for global CSS, maintaining state, persisting layout, etc. Eachpage
is rendered inside of_app
via<Component {...pageProps} />
pages/index.js
would be accessible athttp://localhost:3000
page/_app.js
is not accessible at any route, instead each page uses it as a "wrapper"See the docs on
_app