Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More β†’
Socket
Sign inDemoInstall
Socket

rest-hooks

Package Overview
Dependencies
Maintainers
1
Versions
328
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

rest-hooks

Simple typed React hooks for REST APIs

  • 0.7.0-beta.1
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
1.8K
increased by36.7%
Maintainers
1
Weekly downloads
Β 
Created
Source

πŸ›ŒπŸŽ£ Rest hooks build status Coverage Status 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 = useDispatch(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

Keywords

FAQs

Package last updated on 24 Feb 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

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚑️ by Socket Inc