1.本质是object类型的对象(一般对象)
2.虚拟React比较“轻‘,真实”DOM“比较重,因为虚拟DOM是React内部在用,无需那么多的属性
<!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8"> <meta http-equiv="X-UA-Compatible" content="IE=edge"> <meta name="viewport" content="width=device-width, initial-scale=1.0"> <title>使用js创建DOM</title> </head> <body> <div id="test"></div> <script src="./react-resource/react.development.js"></script> <script src="./react-resource/react-dom.development.js"></script> <script type="text/javascript"> const VDOM = (<h1 title="test"> <span>Hello!react</span> </h1>); ReactDOM.render(VDOM, document.getElementById("test")); console.log("VDOM",typeof VDOM); console.log(VDOM instanceif object); //在这里表示VDOM是否属于对象类型 </script> </body> </html>
3.获得属性的方法:在代码后面加上debugger
4.虚拟DOM会被React转化为真实DOM