Created
December 30, 2021 15:49
-
-
Save onosendi/9b09c6b20082f28288509c2d01cb7c9f 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
export default function Foo() { | |
const { | |
data, | |
setData, | |
} = useSomeContextHook(); | |
useEffect(async () => { | |
const response = await api('/some/url'); | |
setData(response); | |
}, []); | |
if (!data) { | |
return <p>No data</p>; | |
} | |
return data.map((item) => <p>{item.foo}</p>); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment