ππ£ Rest hooks
Making dynamic sites performant, scalable, simple to build with almost any API design.
Simple TypeScript definition
class ArticleResource extends Resource {
readonly id: number | null = null;
readonly title: string = '';
readonly body: string = '';
pk() { return this.id; }
static urlRoot = '/articles/';
}
One line data hookup
const article = useResource(ArticleResource.singleRequest(), { id });
return (
<>
<h2>{article.title}</h2>
<p>{article.body}</p>
</>
);
And mutation
const update = useDispatch(ArticleResource.updateRequest(), { id });
return <ArticleForm onSubmit={update} />;
...all typed ...fast ...and consistent
For the small price of 6kb gziped. Β Β πGet started now
Features