Created
January 20, 2020 20:06
-
-
Save bartcis/a35a628ad4da270ad753bc006d99eb1d 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