e도서관/Next.js
Next.js 시작하기
Heoky
2022. 1. 9. 00:34
공식문서 참고: https://nextjs.org/docs/getting-started
Getting Started | Next.js
Get started with Next.js in the official documentation, and learn more about all our features!
nextjs.org
프로젝트/font 안에 next와 react, react-dom을 설치
$npm install next
$npm install next react react-dom
package.json의 script를 설정해준다.
{
"name": "front",
"version": "1.0.0",
"description": "",
"main": "index.js",
"scripts": {
"dev": "next",
"build": "next build"
},
"author": "KYH",
"license": "ISC",
"dependencies": {
"next": "^12.0.7",
"react": "^17.0.2",
"react-dom": "^17.0.2",
},
"devDependencies": {
...
}
}
front/pages/index.js
import React from 'react'
const Home = () => {
return (
<>
<div>hello, next!</div>
</>
)
}
next.js 실행하기
$npm run dev
http://localhost:3000/