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

Function Bar

src/script.ts:3–28  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

1import * as React from "./react/core";
2
3export const Bar = () => {
4 const [isRenderingSpan, setIsRenderingSpan] = React.useState(false);
5 const [x, setX] = React.useState(2);
6 return React.createElement(
7 "area",
8 {},
9 React.createElement(Foo, null),
10 React.createElement("button", {
11 innerText: "conditional render",
12 onclick: () => {
13 setIsRenderingSpan(!isRenderingSpan);
14 },
15 }),
16 React.createElement("button", {
17 innerText: `Count: ${x}`,
18 onclick: () => {
19 setX(x + 1);
20 },
21 }),
22 isRenderingSpan &&
23 React.createElement("span", {
24 style:
25 "display:flex; height:50px; width:50px; background-color: white;",
26 })
27 );
28};
29
30export const ConditionalRender = () => {
31 const [isRenderingSpan, setIsRenderingSpan] = React.useState(false);

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected