Skip to main content
Version: 5.0

Installation

npm install --save rest-hooks @rest-hooks/test @rest-hooks/hooks @rest-hooks/rest

TypeScript is optional, but requires at least version 3.7 for full type enforcement.

Add provider at top-level component

/index.tsx
import { CacheProvider } from 'rest-hooks';
import ReactDOM from 'react-dom';

ReactDOM.render(
<CacheProvider>
<App />
</CacheProvider>,
document.body,
);

Alternatively integrate state with redux

Legacy (IE) browser support

If you see Uncaught TypeError: Class constructor Resource cannot be invoked without 'new', follow the instructions to add legacy browser support to packages