Skip to content

Instantly share code, notes, and snippets.

@NaveenDA
Created April 30, 2021 20:16
Show Gist options
  • 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