Created
May 17, 2019 09:01
-
-
Save austinroy/943ea1437787ec59bc9df35f399d02b1 to your computer and use it in GitHub Desktop.
Cached Supsense with react-cache
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 getInfo = () => fetch("https://myApi.apiexample").then(res => res.json()) | |
const ApiResource = createResource(getInfo) | |
const SayHello = () => { | |
const data = ApiResource.read() | |
return <div>Hi {data.name}</div> | |
} | |
const App = () => ( | |
<Suspense fallback={<Spinner />}> | |
<SayHello /> | |
</Suspense> | |
) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment