Promise-based React Data Loader – react-async

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.

Features:

  • Zero dependencies
  • Works with promises, async/await and the Fetch API
  • Choose between Render Props, Context-based helper components or the useAsync and useFetch hooks
  • Provides convenient isLoadingstartedAtfinishedAt, et al metadata
  • Provides cancel and reload actions
  • Automatic re-run using watch or watchFn prop
  • Accepts onResolve and onReject callbacks
  • Supports abortable fetch by providing an AbortController
  • Supports optimistic updates using setData
  • Supports server-side rendering through initialValue
  • Comes with type definitions for TypeScript
  • Works well in React Native too!

Installation:

# Yarn
$ yarn add react-async

# NPM
$ npm install react-async --save

Preview:

 

Download Details:

Author: ghengeveld

Live Demo: View The Demo

Download Link: Download The Source Code

Official Website: https://github.com/ghengeveld/react-async

License: MIT

You Might Be Interested In:

Add Comment