Last active
February 19, 2019 10:59
-
-
Save simoneb/1195a5b056541a87f2abdfe217bd00a6 to your computer and use it in GitHub Desktop.
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
function useAxios(url) { | |
const [response, setResponse] = React.useState() | |
React.useEffect(() => { | |
axios(url) | |
.then(response => setResponse(response)) | |
.catch(error => setResponse(error)) | |
}, [url]) | |
return response | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment