Created
April 30, 2021 20:16
-
-
Save NaveenDA/ac8ae41a911c0deb91dd50cf827fc8e9 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
import useSWR from 'swr' | |
function Profile() { | |
const { data, error } = useSWR('/api/user', fetcher) | |
if (error) return <div>failed to load</div> | |
if (!data) return <div>loading...</div> | |
return <div>hello {data.name}!</div> | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment