Created
June 12, 2023 19:42
-
-
Save AguacateVelarde/c3e39b75b8b2f2f68a5a1e1a79f3167e to your computer and use it in GitHub Desktop.
Abort controller simple example
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const controller = new AbortController(); | |
const signal = controller.signal; | |
const response = await fetch( | |
`https://jsonplaceholder.typicode.com/posts/${value}`, | |
{ signal } | |
); | |
const abortRequest = () => controller.abort(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment