React - 2
2020. 4. 2. 21:19ㆍ포트폴리오/React
React 커맨드 사용
1. ReactDOM.render(displayResult, root)
displayResult : 나타낼 결과
root : 나타낼 위치(id)
React.createElement(tag, attribute, content)
tag: html 태그(h1,a태그 등)
state: attribute: 속성(a태그 href)
content: 표시할 컨텐츠("hello react")
<html>
<head>
<script crossorigin src="https://unpkg.com/react@16/umd/react.development.js"></script>
<script crossorigin src="https://unpkg.com/react-dom@16/umd/react-dom.development.js"></script>
</head>
<div id="root">
</div>
<script type="text/javascript">
const displayResult = React.createElement(
"h1",
null,
"Hello React !!"
)
ReactDOM.render(displayResult, root);
</script>
</html>
출처: https://kim6394.tistory.com/111?category=681336 [Gyoogle (규글)]
'포트폴리오 > React' 카테고리의 다른 글
useState 배열 수정 (0) | 2021.01.15 |
---|---|
setState는 비동기 (0) | 2020.08.25 |
React - 4 (0) | 2020.04.02 |
React - 3 (0) | 2020.04.02 |
React - 1 (0) | 2020.04.02 |