Different between _app.tsx and app.tsx?

Kyle_Kim·2023년 7월 12일
0

한줄요약

next.js는 _app.tsx를 쓰고 app.tsx는 쓰지 않는다.

In Next.js, _app.tsx and app.tsx serve different purposes.

_app.tsx:

The _app.tsx file is a special file in Next.js that acts as the root component for your application. It is responsible for initializing global styles, providing data-fetching and state management providers, and maintaining the overall layout and structure of your app.

You should create the _app.tsx file in the pages/ directory.

Here's an example of an _app.tsx file:

app.tsx:

On the other hand, app.tsx is not a special file in Next.js. It does not have any specific functionality or meaning within the Next.js framework.
You can create the app.tsx file anywhere in your project's directory structure, depending on your desired organization and file structure.

To summarize, _app.tsx is a special file in Next.js that acts as the root component of your application, while app.tsx is a generic file that you can create for custom purposes in your Next.js project.

profile
Make Things Right

0개의 댓글