Skip to content

Instantly share code, notes, and snippets.

@moshfeu
Created June 30, 2020 11:18
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save moshfeu/406ee08315f6cc5b83707f1b8cd019a6 to your computer and use it in GitHub Desktop.
Save moshfeu/406ee08315f6cc5b83707f1b8cd019a6 to your computer and use it in GitHub Desktop.
const App = () => {
const [isLoadgin, setIsLoading] = useState(true)
const [cardInfo, setCardInfo] = useContext(CardInfoContext)
useEffect(() => {
fetchData(result => {
setCardInfo(result);
setIsLoading(false);
})
}, [])
return (
<>
<div className="app">
{isLoading && <h1 className="loadingNotice">Fetching data...</h1>}
{
cardInfo.map(card => <img src={card.image} />)
}
</div>
</>
)}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment