[ReactJS 이론] #1 Element Rendering

mechaniccoder·2020년 5월 25일
0

ReactJS이론

목록 보기
1/4
post-thumbnail

How to render?

<div id="root"></div>

이 안에 들어가는 모든 엘리먼트는 React DOM에서 관리하기 때문에 이것을 루트 DOM 노드라고 한다.

const element = <h1>Hello, world</h1>;
ReactDOM.render(element, document.getElementById('root'));

So, we can use ReactDOM.render() to transfer reactDOM TO root DOM node.

React element is unchanged object(불변객체)

The only thing we can update the UI is making new element and transfering by ReactDOM.render().

ReactDOM compares elements before and then updates DOM that has changed things.

Think clock app that is changed every second. You should think how the UI show up at a specific point in time not how the UI will be changed by the time.

Reference

profile
세계 최고 수준을 향해 달려가는 개발자입니다.

0개의 댓글