Skip to content
/ xswr Public

😇 A data fetching solution for React Hooks and Imperative Ajax request

Notifications You must be signed in to change notification settings

red-armor/xswr

Folders and files

NameName
Last commit message
Last commit date

Latest commit

ad59599 · Aug 1, 2020

History

82 Commits
May 26, 2020
May 24, 2020
Mar 10, 2020
Jul 13, 2020
Mar 1, 2020
May 12, 2020
Feb 29, 2020
Mar 1, 2020
May 24, 2020
Feb 29, 2020
May 12, 2020
Jul 13, 2020
Aug 1, 2020
May 12, 2020
May 12, 2020

Repository files navigation

English | 简体中文

xswr

A data fetching solution for React Hooks and Imperative Ajax request

npm version NPM downloads code style: prettier

Introduction

xswr is inspired by swr and documentation HTTP RFC 5861 mentioned in its readme file. In general, comparing with swr, xswr has following features

  1. Scenario, applicable for React Hooks and Promise-base Ajax request
  2. Isolated Configuration Context, fetcher is identified by key param and shared by items with same key, config is isolated from each other.
  3. Re-render control, In React Hooks, it is configurable to control whether re-render component or not caused by data change.
  4. Easy to use, In Promise-based Ajax chain request, retry and pooling could be performed automatically.

Installation

With npm

npm install xswr

With yarn

yarn add xswr

How does xswr works

basic mechanism

Usage

  1. useXS - React Hooks solution
  2. xs - Promise-based Ajax solution