Skip to content

Commit e0d320e

Browse files
Update example
1 parent d110f8e commit e0d320e

1 file changed

Lines changed: 8 additions & 3 deletions

File tree

.agents/review-checklists/react/code-quality.md

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -80,11 +80,16 @@ const Counter: FC = () => {
8080
};
8181

8282
// ❌ Custom hook with async logic but no tests
83-
const useCustomFetch = (url: string) => {
83+
const useItemData = (id: string) => {
8484
const [data, setData] = useState(null);
8585
useEffect(() => {
86-
fetch(url).then(res => res.json()).then(setData);
87-
}, [url]);
86+
// Error handling omitted for brevity
87+
async function load() {
88+
const result = await loadItemById(id);
89+
setData(result);
90+
}
91+
load();
92+
}, [id]);
8893
return data;
8994
};
9095
```

0 commit comments

Comments
 (0)