1、JSX语法渲染流程:使用jsx语法 => 调用React.createElement()函数 => 返回vNode(虚拟节点) => 渲染到页面上
2、React.createElment(type|标签名,props|属性的对象集合,children..|各种节点)
const React = {
createElement(type, props, ...children){//扩展运算符:后面所有属性收集成一个数组
return {
type,
props,
children
}
}
}
const div = <div id = "odiv">hello<span id="">world</span></div>;
const render = (vNode, container) => {
if(typeof vNode == "string"){//文本结点直接插入
const text = document.createTextNode(vNode);
return container.appendChild(text);
}
const {type, props, children} = vNode;//解构赋值
const ele = document.createE