1、问题背景
有个元素div,向里插入内容React,利用React来实现
2、实现源码
<!DOCTYPE html> <html> <head> <Meta charset="UTF-8"> <title>React节点插入内容</title> <script type="text/javascript" src="../js/react.js" ></script> <script type="text/javascript" src="../js/react-dom.js" ></script> <script type="text/javascript" src="../js/browser.min.js" ></script> <script type="text/babel"> ReactDOM.render( <label>React</label>,document.getElementById("titleDiv") ) </script> </head> <body> <div id="titleDiv"></div> </body> </html>
3、实现结果