Created
June 20, 2020 16:02
-
-
Save noximus/4d1ece65ffe1eb5588b34f7aed1944de to your computer and use it in GitHub Desktop.
Axios & Hooks
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 Nox() { | |
const [data, setData] = React.useState({}); | |
React.useEffect(() => { | |
axios.get('/nox-daily-message').then(({ data }) => { | |
setData(data); | |
}); | |
}, []); | |
return data.ywmib ? <strong>{data.ywmib}</strong> : <div>Loading...</div> | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment