웹에서 보여주는것은 index.html이지만 index.html의 실질적인 내용은 App.js에 있다
즉, index.html의
<div id="root"></div>
부분에 id가 root인 부분이 입력되는것인데 이걸 연결해주는것이 바로
index.js이다,
---- index.js ----
import React from 'react'; import ReactDOM from 'react-dom'; import './index.css'; import App from './App'; import reportWebVitals from './reportWebVitals'; ReactDOM.render( <React.StrictMode> <App /> </React.StrictMode>, document.getElementById('root') ); reportWebVitals(); |
document.getElementById('html에 넘겨줄ID)
<App />부분은 App.js에서 설정해준 fucntion App()을 의미한다.
728x90
반응형