플젝 셋팅 (next js)

Heewon👩🏻‍💻·2024년 5월 9일

수동설치할꺼임.

terminal 켜주고 폴더 하나 만들어줄꺼임

"mkdir 파일명"

mkdir learn-nextjs14

생성된 파일로 이동

cd learn-nextjs14

VScode로 파일열어주고, terminal에 기본 셋팅해줄꺼임

npm init -y
npm install react@latest next@latest react-dom@latest

생성된 package.json파일에 변경이 필요함

  1. scripts : dev라는 명령어를 실행시면 next js 프레임워크를 적용시킬꺼임
"scripts": {
    "dev": "next dev"
  },
  1. license : 버전호환성을 위해 MIT으로 바꿔줘야함.
"license": "MIT"

dev명령어를 사용하면 next js에서 "page"라는 파일을 찾는다. 그리고 그 파일은 App()이라는 폴더 안에 위치해야한다.

[create new file]
app/page.jsx (or tsx 자유) (o)
application/page (x)
app/Page(x)

page에

export default funtion 아무이름(){
	return <h1>HI FUCK YA~</h1>
}

terminal에 npm run dev
해주면 next js가 실행되고 필요한 부분은 알아서 체워줌.. 미친
아무것도 import안해도 된다. 심지어 react로 안해옴 ㅎ

특별한 파일명을 가진게 있는게 그 중 제일 흔한게
1. page.jsx
2. not-found.jsx
3. layout.jsx
이다.

profile
Interested in coding, meat lover, in love with dogs , enjoying everything happens in my life.

0개의 댓글