티스토리 뷰

프론트엔드/React

React Folder Structure

celine_e 2023. 2. 2. 14:06

1. npx create-react-app my-app 을 한 후 의 폴더 구조 입니다. 

my-app/
  README.md
  node_modules/
  package.json
  public/
    index.html
    favicon.ico
  src/
    App.css
    App.js
    App.test.js
    index.css
    index.js
    logo.svg

 

2. 처음 npm start를 했을 때 나오는 화면은 src/ app.js 파일 입니다.  

 

3. app.js는 index.js에 App 컴포넌트로 들어가 있는 형태입니다. 

document.getElementById('root')) 는 public/index.html의 id="root "를 그려줍니다. 

 - public/index.html   -> page template

 - src/index.js  -> Javascript entry point

 

 public/
    index.html
    favicon.ico

public 폴더에 있는 파일들은 오직은 public/index.html만 쓰일 수 있습니다. 

 

src/
    App.css
    App.js
    App.test.js
    index.css
    index.js
    logo.svg

- Webpack에 의해 관리가 되는 파일들은 src 폴더 안에 있는 것만 관리가 되기 때문에 css와 image 파일들은  src 폴더에 넣어주어야 합니다. 그렇지 않으면 webpack에 의해 관리가 되지 않습니다. 

 

https://create-react-app.dev/docs/folder-structure

 

Folder Structure | Create React App

After creation, your project should look like this:

create-react-app.dev

 

'프론트엔드 > React' 카테고리의 다른 글

Redux  (0) 2023.02.03
React Router Dom  (0) 2023.02.02
npm, npx  (0) 2023.01.18
Nodemon  (0) 2023.01.17
Node.js / express.js  (0) 2023.01.16
공지사항
최근에 올라온 글
최근에 달린 댓글
Total
Today
Yesterday
링크
«   2026/04   »
1 2 3 4
5 6 7 8 9 10 11
12 13 14 15 16 17 18
19 20 21 22 23 24 25
26 27 28 29 30
글 보관함