Skip to content

Commit

Permalink
Update
Browse files Browse the repository at this point in the history
[ghstack-poisoned]
  • Loading branch information
poteto committed Jul 25, 2024
2 parents f516a8c + b1da515 commit daa8d03
Show file tree
Hide file tree
Showing 2 changed files with 58 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,10 @@
## Input

```javascript
function Component(props) {
return <View {...props} />;
}

const View = React.memo(({items}) => {
return (
<ul>
Expand All @@ -12,12 +16,37 @@ const View = React.memo(({items}) => {
);
});

export const FIXTURE_ENTRYPOINT = {
fn: Component,
params: [
{
items: [
{id: 2, name: 'foo'},
{id: 3, name: 'bar'},
],
},
],
};

```

## Code

```javascript
import { c as _c } from "react/compiler-runtime";
function Component(props) {
const $ = _c(2);
let t0;
if ($[0] !== props) {
t0 = <View {...props} />;
$[0] = props;
$[1] = t0;
} else {
t0 = $[1];
}
return t0;
}

const View = React.memo((t0) => {
const $ = _c(4);
const { items } = t0;
Expand All @@ -39,11 +68,23 @@ const View = React.memo((t0) => {
}
return t2;
});

export const FIXTURE_ENTRYPOINT = {
fn: Component,
params: [
{
items: [
{ id: 2, name: "foo" },
{ id: 3, name: "bar" },
],
},
],
};
function _temp(item) {
return <li key={item.id}>{item.name}</li>;
}

```
### Eval output
(kind: exception) Fixture not implemented
(kind: ok) <ul><li>foo</li><li>bar</li></ul>
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
function Component(props) {
return <View {...props} />;
}

const View = React.memo(({items}) => {
return (
<ul>
Expand All @@ -7,3 +11,15 @@ const View = React.memo(({items}) => {
</ul>
);
});

export const FIXTURE_ENTRYPOINT = {
fn: Component,
params: [
{
items: [
{id: 2, name: 'foo'},
{id: 3, name: 'bar'},
],
},
],
};

0 comments on commit daa8d03

Please sign in to comment.