File tree Expand file tree Collapse file tree 4 files changed +95
-0
lines changed
compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler Expand file tree Collapse file tree 4 files changed +95
-0
lines changed Original file line number Diff line number Diff line change 1+
2+ ## Input
3+
4+ ``` javascript
5+ // @panicThreshold(none)
6+ ' use no memo' ;
7+
8+ function Foo () {
9+ return < button onClick= {() => alert (' hello!' )}> Click me! < / button> ;
10+ }
11+
12+ ```
13+
14+ ## Code
15+
16+ ``` javascript
17+ // @panicThreshold(none)
18+ " use no memo" ;
19+
20+ function Foo () {
21+ return < button onClick= {() => alert (" hello!" )}> Click me! < / button> ;
22+ }
23+ function _temp () {
24+ return alert (" hello!" );
25+ }
26+
27+ ```
28+
29+ ### Eval output
30+ (kind: exception) Fixture not implemented
Original file line number Diff line number Diff line change 1+ // @panicThreshold (none)
2+ 'use no memo' ;
3+
4+ function Foo ( ) {
5+ return < button onClick = { ( ) => alert ( 'hello!' ) } > Click me!</ button > ;
6+ }
Original file line number Diff line number Diff line change 1+
2+ ## Input
3+
4+ ``` javascript
5+ // @noEmit
6+
7+ function Foo () {
8+ ' use memo' ;
9+ return < button onClick= {() => alert (' hello!' )}> Click me! < / button> ;
10+ }
11+
12+ export const FIXTURE_ENTRYPOINT = {
13+ fn: Foo,
14+ params: [],
15+ };
16+
17+ ```
18+
19+ ## Code
20+
21+ ``` javascript
22+ import { c as _c } from " react/compiler-runtime" ; // @noEmit
23+
24+ function Foo () {
25+ " use memo" ;
26+ const $ = _c (1 );
27+ let t0;
28+ if ($[0 ] === Symbol .for (" react.memo_cache_sentinel" )) {
29+ t0 = < button onClick= {_temp}> Click me! < / button> ;
30+ $[0 ] = t0;
31+ } else {
32+ t0 = $[0 ];
33+ }
34+ return t0;
35+ }
36+ function _temp () {
37+ return alert (" hello!" );
38+ }
39+
40+ export const FIXTURE_ENTRYPOINT = {
41+ fn: Foo,
42+ params: [],
43+ };
44+
45+ ```
46+
47+ ### Eval output
48+ (kind: ok) <button >Click me!</button >
Original file line number Diff line number Diff line change 1+ // @noEmit
2+
3+ function Foo ( ) {
4+ 'use memo' ;
5+ return < button onClick = { ( ) => alert ( 'hello!' ) } > Click me!</ button > ;
6+ }
7+
8+ export const FIXTURE_ENTRYPOINT = {
9+ fn : Foo ,
10+ params : [ ] ,
11+ } ;
You can’t perform that action at this time.
0 commit comments