on
[React] Movie Rating Web Service-0.0. React 개발 환경 설정
[React] Movie Rating Web Service-0.0. React 개발 환경 설정
728x90
react 사용에 필요한 것
- nodeJS, npm, npx, git, code editor
- nodeJS 설치 시 npm이 함께 설치된다. (yarn과 npm은 동일한 역할을 수행한다.)
- 원하는 code editor 사용 ex) VSCode, Sublime Text, Brackets, Atom, Vim etc..
react를 배우기 전 기본적으로 알아야 할 것
- html, css, vanillaJS
1. npx install
> npm install npx -g
2. create app
> npx create-react-app
ex) npx create-react-app myapp
3. app 실행
> cd myapp
> npm start
< App.js >
import React from "react"; function App(){ return Hello!; } export default App;
< Index.html >
React App You need to enable JavaScript to run this app.
< Index.js >
import React from "react"; import ReactDOM from "react-dom"; import App from "./App"; ReactDOM.render(, document.getElementById("root"));
- index.js는 ReactDom.render를 통해 app.js의 App() component(함수)를 index.html의 "root"라는 id를 가진 div에 render 한다.
→ ReactDom.render는 라는 application을 render 한다.
→ getElementById를 통해 index.html 의 를 선택한다.
* react는 모든 react application을 div 사이에 넣는다.
728x90
from http://mingmeng030.tistory.com/182 by ccl(A) rewrite - 2021-09-19 18:26:51