File tree Expand file tree Collapse file tree 2 files changed +57
-0
lines changed
compiler/packages/babel-plugin-react-forget/src/__tests__/fixtures/compiler Expand file tree Collapse file tree 2 files changed +57
-0
lines changed Original file line number Diff line number Diff line change
1
+
2
+ ## Input
3
+
4
+ ``` javascript
5
+ // @gating
6
+ function Component () {
7
+ const name = Component .name ;
8
+ return < div> {name}< / div> ;
9
+ }
10
+
11
+ export const FIXTURE_ENTRYPOINT = {
12
+ fn: Component,
13
+ params: [],
14
+ };
15
+
16
+ ```
17
+
18
+ ## Code
19
+
20
+ ``` javascript
21
+ import { isForgetEnabled_Fixtures } from " ReactForgetFeatureFlag" ;
22
+ import { unstable_useMemoCache as useMemoCache } from " react" ; // @gating
23
+ const Component = isForgetEnabled_Fixtures ()
24
+ ? function Component () {
25
+ const $ = useMemoCache (1 );
26
+ const name = Component .name ;
27
+ let t0;
28
+ if ($[0 ] === Symbol .for (" react.memo_cache_sentinel" )) {
29
+ t0 = < div> {name}< / div> ;
30
+ $[0 ] = t0;
31
+ } else {
32
+ t0 = $[0 ];
33
+ }
34
+ return t0;
35
+ }
36
+ : function Component () {
37
+ const name = Component .name ;
38
+ return < div> {name}< / div> ;
39
+ };
40
+
41
+ export const FIXTURE_ENTRYPOINT = {
42
+ fn: Component,
43
+ params: [],
44
+ };
45
+
46
+ ```
47
+
Original file line number Diff line number Diff line change
1
+ // @gating
2
+ function Component ( ) {
3
+ const name = Component . name ;
4
+ return < div > { name } </ div > ;
5
+ }
6
+
7
+ export const FIXTURE_ENTRYPOINT = {
8
+ fn : Component ,
9
+ params : [ ] ,
10
+ } ;
You can’t perform that action at this time.
0 commit comments