Skip to content

Commit a55c94d

Browse files
committed
docs: minor improvements
1 parent 018768e commit a55c94d

File tree

1 file changed

+19
-1
lines changed

1 file changed

+19
-1
lines changed

packages/plugins/eslint-plugin-react-x/src/rules/jsx-no-iife.md

Lines changed: 19 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -68,6 +68,24 @@ function MyComponent() {
6868
}
6969
```
7070

71+
```tsx
72+
function MyComponent() {
73+
// hooks etc
74+
75+
const thingsList = useMemo(() => things.filter(callback), [things, callback]);
76+
77+
return (
78+
<SomeJsx>
79+
<SomeMoreJsx />
80+
{thingsList.length === 0
81+
? <Empty />
82+
: thingsList.map((thing) => <Thing key={thing.id} data={thing} />)}
83+
<SomeMoreJsx />
84+
</SomeJsx>
85+
);
86+
}
87+
```
88+
7189
```tsx
7290
function MyComponent() {
7391
// hooks etc
@@ -80,7 +98,7 @@ function MyComponent() {
8098
}
8199

82100
return filteredThings.map((thing) => <Thing key={thing.id} data={thing} />);
83-
}, [things]);
101+
}, [things, callback]);
84102

85103
return (
86104
<SomeJsx>

0 commit comments

Comments
 (0)