iT邦幫忙

0

React關於DOM

DOM
就像下面的程式碼,DOM就是html、head、body、div、tr、td之類的。

<!doctype html>
<html lang="zh" dir="ltr">
<head>
</head>
<body>
  <div id="custom-bg"></div>
  <div id="custom-bg-preview"></div>
  <!-- Container for the OneGoogleBar HTML. -->
  <div id="one-google"></div>
  ....
</body>
</html>

而在我們撰寫程式碼時要用到的就是取得DOM元素的id位置document.getElementById('example'),將我們製作好的內容JSX型態的內容例:Hello放進去。

<div id="example"></div>
ReactDOM.render(<div>Hello</div>,document.getElementById('example'));

圖片
  直播研討會
圖片
{{ item.channelVendor }} {{ item.webinarstarted }} |
{{ formatDate(item.duration) }}
直播中

尚未有邦友留言

立即登入留言