-
-
Save jgthms/45eb39cda516c21cb7a866f45e894cd7 to your computer and use it in GitHub Desktop.
Function to fetch and update abort functions
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 fetchOnClick = async () => { | |
try { | |
abortFuncs.current.unshift(abortArticleRequest); | |
const newArticleRequest = await articleRequest; | |
const newArticle = await newArticleRequest.json(); | |
setState([...state, newArticle]); | |
setArticleId(articleId +1); | |
} catch(e) { | |
console.error(e); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment