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

Function ConditionalRender

src/script.ts:30–47  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

28};
29
30export const ConditionalRender = () => {
31 const [isRenderingSpan, setIsRenderingSpan] = React.useState(false);
32 return React.createElement(
33 "div",
34 null,
35 React.createElement("button", {
36 innerText: "conditional render",
37 onclick: () => {
38 setIsRenderingSpan(!isRenderingSpan);
39 },
40 }),
41 isRenderingSpan &&
42 React.createElement("span", {
43 style:
44 "display:flex; height:50px; width:50px; background-color: white;",
45 })
46 );
47};
48export const Foo = () => {
49 const [x, setX] = React.useState(2);
50 const foo = React.createElement(

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected