react-isomorphic-data
Easily fetch data in your React components, with similar APIs to react-apollo 🎉
You can use hooks or HOC, both are supported. 🎉
NOTE: This project is still very much work in progress, use at your own risk ⚠️
Features
- React hooks
- SSR support with Suspense using react-ssr-prepass (No multi-rendering on the server!)
- Simple built-in cache
- TypeScript support
- Testing utilities
- React Suspense integration for implementing render-as-you-fetch pattern ⚠️ (experimental)
Installing
yarn add react-isomorphic-data
Example
;;; const dataClient = ; const Component = { const data loading = ; return <div> <h1>This is a Component</h1> loading ? 'loading...' : <div> <pre>JSON</pre> </div> </div> ;}; ReactDOM;
SSR example with express
;;;;;; ; // react-isomorphic-data needs fetch to be available in the global scopeglobalfetch = fetch; const server = ; server;
Documentations
The documentations live at: https://react-isomorphic-data.netlify.com/
Feel free to open an issue if you have something in mind!