New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More โ†’

rest-hooks

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

rest-hooks

Simple typed React hooks for REST APIs


Version published
Weekly downloads
994
decreased by-27.29%
Maintainers
1
Weekly downloads
 
Created

๐Ÿ›Œ๐ŸŽฃ Rest hooks

CircleCI Coverage Status npm downloads JS gzip size npm version

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 = useDispatcher(ArticleResource.updateRequest(), { id });
return <ArticleForm onSubmit={update} />;

...all typed ...fast ...and consistent

For the small price of 6kb gziped.    ๐ŸGet started now

Features

  • TypeScript Strong Typescript types
  • ๐Ÿšฆ React Suspense support
  • ๐ŸŽฃ Simple declarative API
  • ๐Ÿ’ฐ Normalized response caching
  • ๐Ÿ’ฅ Tiny bundle footprint
  • ๐Ÿ›‘ Automatic overfetching elimination
  • โœจ Optimistic updates
  • ๐Ÿง˜ Flexible to fit any API design (one size fits all)
  • ๐Ÿšฏ Pluggable garbage collection policy
  • ๐Ÿ” Subscriptions
  • โ™ป๏ธ Optional redux integration
  • ๐Ÿ“™ Storybook mocking

FAQs

Package last updated on 02 Mar 2019

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts