MCPcopy Create free account
hub / github.com/QuarkGluonPlasma/react-course-code / createElement

Function createElement

mini-react/src/mini-react.js:2–13  ·  view source on GitHub ↗
(type, props, ...children)

Source from the content-addressed store, hash-verified

1(function() {
2 function createElement(type, props, ...children) {
3 return {
4 type,
5 props: {
6 ...props,
7 children: children.map((child) => {
8 const isTextNode = typeof child === "string" || typeof child === "number";
9 return isTextNode ? createTextNode(child) : child;
10 }),
11 },
12 };
13 }
14
15 function createTextNode(nodeValue) {
16 return {

Callers

nothing calls this directly

Calls 1

createTextNodeFunction · 0.85

Tested by

no test coverage detected