index.js
import React from 'react';
import ReactDOM from 'react-dom';
import './index.css';
import App from './App';//<app/>js的普通对象
/*let app = < App / >let root = document.getElementById('root')let h1=<h1>helloworld<span>我是</span></h1>
{ ReactDOM.render(h1, root
); }*/
//实现时刻的变化
function clock() {let time = new Date().toLocaleTimeString()let element = ( < div > < h1 > 现在的时间 { time } < /h1></div > )let root = document.querySelector('#root')ReactDOM.render(element, root)
}
clock()setInterval(clock, 1000)
运行结果