Skip to content

Instantly share code, notes, and snippets.

@simistern
Created November 20, 2020 17:02
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 simistern/9aea8f74279fe4f45910a0ce51c11542 to your computer and use it in GitHub Desktop.
Save simistern/9aea8f74279fe4f45910a0ce51c11542 to your computer and use it in GitHub Desktop.
const ArticleView = () => {
const { loading, error, data } = useResource<Article>('/article/1');
if (loading) return <p>Loading…</p>;
if (error) return <div class="error">{error.message}</div>;
return (
<article>
<h1>{data.title}</h1>
<p>{data.body}</p>
</article>
)
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment