1 Star 0 Fork 31

罗移/react-source

forked from DEV-Edu/react-source 
加入 Gitee
与超过 1400万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
文件
该仓库未声明开源许可证文件(LICENSE),使用请关注具体项目描述及其代码上游依赖。
克隆/下载
createElement.js 457 Bytes
一键复制 编辑 原始数据 按行查看 历史
yuanjin 提交于 2023-08-03 18:40 +08:00 . feat: 全部课程资料
// const element = React.createElement('h1', { title: 'foo' }, 'Hello');
export function createElement(type, props, ...children) {
return {
type,
props: {
...props,
children: children.map((child) =>
typeof child === 'object' ? child : createTextElement(child)
),
},
};
}
function createTextElement(text) {
return {
type: 'TEXT_ELEMENT',
props: {
nodeValue: text,
children: [],
},
};
}
Loading...
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
1
https://gitee.com/LsimpleY/react-source.git
git@gitee.com:LsimpleY/react-source.git
LsimpleY
react-source
react-source
main

搜索帮助