# xswr

> cross platform swr

Latest version **1.1.0** (published 2020-07-13) · ISC license · 0 weekly downloads

## Install

```sh
npm install xswr
pnpm add xswr
yarn add xswr
bun add xswr
```

## Health

**Score 20/100 (F)** — status: abandoned.

Positive: esm support; no vulnerabilities.

Warnings: low downloads; no types.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 1.1.0 |
| Published | 2020-07-13 |
| First published | 2020-02-23 |
| Weekly downloads | 0 |
| License | ISC |
| TypeScript types | none |
| Module format | ESM + CommonJS |
| Dependencies | 3 |
| Unpacked size | 459.6 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 2 |
| Author | youchaoliu@gmail.com |
| Maintainers | ryuyutyo |
| Keywords | swr, cross-platform, React, request, cache |

## Links

- npm: https://www.npmjs.com/package/xswr
- Repository: https://github.com/red-armor/xswr
- Homepage: https://github.com/red-armor/xswr#readme
- Issues: https://github.com/red-armor/xswr/issues
- npm.io page: https://npm.io/package/xswr

## Dependencies (3)

- [react](https://npm.io/package/react.md) ^16.12.0
- [react-dom](https://npm.io/package/react-dom.md) ^16.12.0
- [deep-equal](https://npm.io/package/deep-equal.md) ^2.0.1

## Alternatives

- [mobx-react](https://npm.io/package/mobx-react.md) — 2.8M weekly downloads
- [rc-tree](https://npm.io/package/rc-tree.md) — 2.6M weekly downloads
- [@react-oauth/google](https://npm.io/package/@react-oauth/google.md) — 1.3M weekly downloads
- [@wagmi/connectors](https://npm.io/package/@wagmi/connectors.md) — 877.0K weekly downloads
- [vee-validate](https://npm.io/package/vee-validate.md) — 836.4K weekly downloads

## Recent versions

- 1.1.0 (latest) — 2020-07-13
- 1.0.1 — 2020-05-12
- 1.0.0 — 2020-05-12
- 0.1.0 — 2020-05-12
- 0.0.7 — 2020-03-10
- 0.0.6 — 2020-03-02
- 0.0.5 — 2020-03-01
- 0.0.4 — 2020-03-01
- 0.0.3 — 2020-03-01
- 0.0.2 — 2020-02-23
- 0.0.1 — 2020-02-23

## README

English | [简体中文](./README-zh_CN.md)

# xswr

_A data fetching solution for React Hooks and Imperative Ajax request_

[![npm version](https://img.shields.io/npm/v/xswr.svg?style=flat)](https://www.npmjs.com/package/xswr) [![NPM downloads](https://img.shields.io/npm/dm/xswr.svg?style=flat-square)](http://www.npmtrends.com/xswr) [![code style: prettier](https://img.shields.io/badge/code_style-prettier-ff69b4.svg)](https://github.com/prettier/prettier)

## Introduction

xswr is inspired by [swr](https://github.com/zeit/swr) and documentation [HTTP RFC 5861](https://tools.ietf.org/html/rfc5861) 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`

```bash
npm install xswr
```

With `yarn`

```bash
yarn add xswr
```

## How does xswr works

![basic mechanism](./docs/xswr.png)

## Usage

1. [useXS - React Hooks solution](./docs/useXS.md)
2. [xs - Promise-based Ajax solution](./docs/xs.md)

---
_Source: https://npm.io/package/xswr · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
