Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: add useAbortableEffect #16

Merged
merged 1 commit into from
Mar 8, 2024
Merged

feat: add useAbortableEffect #16

merged 1 commit into from
Mar 8, 2024

Conversation

Jack-Works
Copy link
Sponsor Contributor

No description provided.

@@ -124,7 +124,8 @@ const ExampleComponent = ({ dataKey }: ExampleComponentProps) => {

Here, although the request for `data1` happened before `data2`, the response for `data2` is received before `data1`. And `useIsMountedRef` doesn't help with that.

To properly avoid `setData(data1)` from being called, the correct pattern is:
To properly avoid `setData(data1)` from being called, the correct pattern is described below.
You can also use [`useAbortableEffect`](./use-abortable-effect) instead.
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Let's append this after with the texy like this:

If your platform supports AbortController, you can also use the useAbortableEffect.

@SukkaW SukkaW merged commit f4f4b58 into SukkaW:master Mar 8, 2024
2 checks passed
@Jack-Works Jack-Works deleted the use-abortable-effect branch March 8, 2024 09:58
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants