MCPcopy Create free account
hub / github.com/RobPruzan/react-scratch / MainComponent

Function MainComponent

src/script.ts:342–375  ·  view source on GitHub ↗
({ children }: any)

Source from the content-addressed store, hash-verified

340};
341
342export const MainComponent = ({ children }: any) => {
343 const [x, setX] = React.useState(2);
344 const memoXPlusOne = React.useMemo(() => x + 1, [x]);
345
346 return React.createElement(
347 // @ts-ignore
348 TestContext.Provider,
349 { value: { hello: x } },
350 React.createElement(LeafComponent, null),
351 // React.createElement(
352 // ContainerComponent,
353 // null,
354 // React.createElement(LeafComponent, null)
355 // ),
356 React.createElement(DualIncrementer, null),
357 // React.createElement(DualIncrementer, null),
358 React.createElement(ActionButton, null),
359 React.createElement(OuterWrapper, null),
360 React.createElement("div", { innerText: "memo'd x + 1: " + memoXPlusOne }),
361 React.createElement(
362 "div",
363 {
364 style: "color:blue",
365 },
366 React.createElement("button", {
367 onclick: () => setX(x + 1),
368 innerText: "RERENDER EVERYTHING " + x,
369 style: "color: orange",
370 })
371 ),
372
373 ...children
374 );
375};
376
377export const MegaChild = () => {
378 console.log("megachild re-render");

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected