Skip to content

Instantly share code, notes, and snippets.

@NaveenDA
Created April 30, 2021 20:16
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 NaveenDA/ac8ae41a911c0deb91dd50cf827fc8e9 to your computer and use it in GitHub Desktop.
Save NaveenDA/ac8ae41a911c0deb91dd50cf827fc8e9 to your computer and use it in GitHub Desktop.
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