_app.js Custom APP file does not work on NEXT JS 13

I want to add a custom APP File on NEXT JS 13, in the documentation:

Next.js uses the App component to initialize pages. You can override it and control the page initialization and:

Persist layouts between page changes Keeping state when navigating pages Inject additional data into pages Add global CSS To override the default App, create the file ./pages/_app.js as shown below:

export default function MyApp({ Component, pageProps }) {
  return <Component {...pageProps} />
}

I add the file, and the code but it does not work.

I am using the new APP Folder to make the routes. So I asume there is another way to make a custom APP file using the APP folder.

Upvotes: 12

Views: 13148

Answers (2)

sam
sam

Reputation: 65

import your global css stuff (with any name you want) inside app/layout.tsx

Upvotes: 1

dbochen
dbochen

Reputation: 252

These _document.jsx and _app.jsx files aren't supported in the app directory.

Here is the official migration documentation

Upvotes: 12

Related Questions