Skip to content

Commit

Permalink
docs(use-abortable-effect): fix typo
Browse files Browse the repository at this point in the history
  • Loading branch information
SukkaW committed Jun 5, 2024
1 parent e57f3e9 commit a25360c
Showing 1 changed file with 6 additions and 4 deletions.
10 changes: 6 additions & 4 deletions docs/src/pages/use-abortable-effect.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -42,8 +42,9 @@ useEffect(() => {
// after
useAbortableEffect((signal) => {
someAsyncStuff().then(data => {
if (!signal.aborted) return
setData(data);
if (!signal.aborted) {
setData(data);
}
});
}, [dataKey]);
```
Expand All @@ -54,8 +55,9 @@ You can also pass the `signal` to your async function if it supports `AbortSigna
useAbortableEffect((signal) => {
someAsyncStuff({ signal })
.then(data => {
if (!signal.aborted) return
setData(data);
if (!signal.aborted) {
setData(data);
}
})
.catch(error => {
if (error.name === 'AbortError') return
Expand Down

0 comments on commit a25360c

Please sign in to comment.