1
+
2
+## Input
3
+
4
+```javascript
5
+const FooContext = React.createContext({ current: null });
6
+
7
+function Component(props) {
8
+ const foo = React.useContext(FooContext);
9
+ const ref = React.useRef();
10
+ const [x, setX] = React.useState(false);
11
+ const onClick = () => {
12
+ setX(true);
13
+ ref.current = true;
14
+ foo.current = true;
15
+ };
16
+ return <div onClick={onClick}>{React.cloneElement(props.children)}</div>;
17
+}
18
+
19
+export const FIXTURE_ENTRYPOINT = {
20
+ fn: Component,
21
+ params: [{ children: <div>Hello</div> }],
22
+};
23
+
24
+```
25
+
26
+## Code
27
+
28
+```javascript
29
+import { unstable_useMemoCache as useMemoCache } from "react";
30
+const FooContext = React.createContext({ current: null });
31
+
32
+function Component(props) {
33
+ const $ = useMemoCache(7);
34
+ const foo = React.useContext(FooContext);
35
+ const ref = React.useRef();
36
+ const [x, setX] = React.useState(false);
37
+ const c_0 = $[0] !== foo.current;
38
+ let t0;
39
+ if (c_0) {
40
+ t0 = () => {
41
+ setX(true);
42
+ ref.current = true;
43
+ foo.current = true;
44
+ };
45
+ $[0] = foo.current;
46
+ $[1] = t0;
47
+ } else {
48
+ t0 = $[1];
49
+ }
50
+ const onClick = t0;
51
+ const c_2 = $[2] !== props.children;
52
+ let t1;
53
+ if (c_2) {
54
+ t1 = React.cloneElement(props.children);
55
+ $[2] = props.children;
56
+ $[3] = t1;
57
+ } else {
58
+ t1 = $[3];
59
+ }
60
+ const c_4 = $[4] !== onClick;
61
+ const c_5 = $[5] !== t1;
62
+ let t2;
63
+ if (c_4 || c_5) {
64
+ t2 = <div onClick={onClick}>{t1}</div>;
65
+ $[4] = onClick;
66
+ $[5] = t1;
67
+ $[6] = t2;
68
+ } else {
69
+ t2 = $[6];
70
+ }
71
+ return t2;
72
+}
73
+
74
+export const FIXTURE_ENTRYPOINT = {
75
+ fn: Component,
76
+ params: [{ children: <div>Hello</div> }],
77
+};
78
+
79
+```
80
+
\ No newline at end of file