Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/qquanwei/recoil-enhance

Enhance recoil
https://github.com/qquanwei/recoil-enhance

Last synced: 14 days ago
JSON representation

Enhance recoil

Awesome Lists containing this project

README

        

## Install

```bash
npm install recoil-enhance
```

## Usage

```diff
import { useRecoilValueMemo, useRecoilValueLoadableMemo } from 'recoil-enhance';

function App() {

- const user = useRecoilValue(userSelector);
+ const user = useRecoilValueMemo(userSelector);

- const userLoadable = useRecoilLoadable(userSelector);
+ const userLoadable = useRecoilLoadableMemo(userSelector);
}
```

## API

### useRecoilValueMemo(recoilState)

like `useRecoilValue`, but will not loading when refresh selector.

### useRecoilValueLoadableMemo

like `useRecoilValueLoadable`, but `loadable.content` always hold latest value.