리액트

리액트

웹앱(WebApp)을 만들때 리액트, 뷰, 앵귤러 같은걸 사용함

리액트 프로젝트 생성 명령어

npx create-react-app 프로젝트명

Success!하면 잘 된것

create-react-app 을 쓰려면 node.js를 설치하면된다.(npm)

처음 프로젝트 생성하고 src/App.js들어가면

import logo from './logo.svg'; import './App.css'; function App() { return ( Edit src/App.js and save to reload. Learn React ); } export default App;

이런코드가 나온다

App.js는 메인(기본)페이지 home.jsp나 index.jsp같은..느낌이지만

메인페이지에 들어갈 html(뼈대)을 작성하는 공간

"실제"메인페이지는 public/index.html

React App You need to enable JavaScript to run this app.

App.js안의 내용을 index.html에 삽입하는 개념

--> 이 과정을 도와주는것은 src/index.js파일임

import React from 'react'; import ReactDOM from 'react-dom'; import './index.css'; import App from './App'; import reportWebVitals from './reportWebVitals'; ReactDOM.render( , document.getElementById('root') ); // If you want to start measuring performance in your app, pass a function // to log results (for example: reportWebVitals(console.log)) // or send to an analytics endpoint. Learn more: https://bit.ly/CRA-vitals reportWebVitals();

이렇게 이해함

터미널에서 npm start 입력하면 아래와 같이 나옴

App.css는 css내용 만듬

package.json은 설치한 라이브러리 관리함

from http://readmeplz.tistory.com/129 by ccl(A) rewrite - 2021-05-11 18:00:26