이 Framework 는 풀스택 웹앱을 개발하기 위한 최선의 Framework 라고 한다. 이 코스가 끝날 때에는 모든 프로그램을 NextJS로 만들고 싶어질거라 한다.
React Framework 중에 1등이라 하는 NextJS
최신 업데이트로 많이 발전했다고 한다.(14기준)
자동화로 개발자 경험 1위 라는데.. 기대가 된다.
React.js 다룰줄 알아야 한다. (state, props, fetch, routing 등을 알아야 하니..)
라이브러리는 개발자가 사용하고, 프레임워크는 코드를 사용한다.
app에서 라우팅 하는 방식과 data fetching하는 법은 많이 바뀌었다.
getStaticProps같은 것은 잊어라. page Router를 사용했다면, 최신 버전을 사용하기 위해선 migration 해야 한다.
npm init -y
// 이후 package.json 생김. author 수정
{
"name": "next-practice",
"version": "1.0.0",
"main": "index.js",
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1"
},
"repository": {
"type": "git",
"url": "git+https://github.com/Eugenius1st/next-practice.git"
},
"keywords": [],
"author": "",
"license": "MIT", // 여기 수정
"bugs": {
"url": "https://github.com/Eugenius1st/next-practice/issues"
},
"homepage": "https://github.com/Eugenius1st/next-practice#readme",
"description": ""
}
npm install react@latest next@latest react-dom@latest
// 이후 스크립트 수정
"scripts": {
"dev": "next dev"
},
실행하면 NextJS는 pages라는 폴더를 찾으로 할 것이다. 그리고 그 폴더는 app 폴더 안에 있을 것이다.
다음
app/page.tsx 혹은 .jsx를 만들어라.
그리고
npm run dev
로 실행
그리고 실행하면 local:3000 에서 실행중임을 알 수 있다.
그리고 자연히 layout.tsx 가 생겨남을 알 수 있다.
export const metadata = {
title: 'Next.js',
description: 'Generated by Next.js',
}
export default function RootLayout({
children,
}: {
children: React.ReactNode
}) {
return (
<html lang="en">
<body>{children}</body>
</html>
)
}