React component and hook for declarative promise resolution and data fetching. Leverages the Render Props pattern and Hooks for ultimate flexibility as well as the new Context API for ease of use.
Makes it easy to handle loading and error states, without assumptions about the shape of your data or the type of request.
- Zero dependencies
- Works with promises, async/await and the Fetch API
- Choose between Render Props, Context-based helper components or the
- Provides convenient
finishedAt, et al metadata
- Automatic re-run using
- Supports abortable fetch by providing an AbortController
- Supports optimistic updates using
- Supports server-side rendering through
- Comes with type definitions for TypeScript
- Works well in React Native too!
# Yarn $ yarn add react-async # NPM $ npm install react-async --save
Live Demo: View The Demo
Download Link: Download The Source Code
Official Website: https://github.com/ghengeveld/react-async