본문 바로가기

리액트 공부하자

개발환경 세팅

Nomad Coder - React Fundamentals 2019 따라가기

 

0. Visual Studio Code 사용

1. node.js 설치

2. npm 설치 (npx)

3. git 설치

 

--

 

***npx create-react-app '폴더이름'***

 

git 명령어

 

git init 초기화(.git 생성)

git add .( "." = 모두)

git commit -m "코멘트"

git push origin master(아마도 master 대신 쓰면 브랜치 이름일듯?)

 

React의 중요 요소

1. index.html

기본적인 html 형식의 파일

2. App.js

import React from 'react';

function App() {
  return <div className="App"/>;
  //return안에 원하는 구조, 기능을 구현함
}
export default App;

3. index.js

import React from 'react';
import ReactDOM from 'react-dom';
import App from './App';

ReactDOM.render(<App />, document.getElementById('root'));
//index.html의 id="root"에다가 App.js를 render 하겠다는 뜻

<App /> 은 Component로 App.js의 function의 return을 받음, HTML과 javascript의 조합 (aka.JSX)

 

 

'리액트 공부하자' 카테고리의 다른 글

Sample Study - Movie List(4)  (0) 2020.02.16
Sample Study - Movie List(3)  (0) 2020.02.12
Sample Study - Movie List(2)  (0) 2020.02.12
Sample Study - Movie List(1)  (0) 2020.02.09
댓글