Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/qquanwei/recoil-enhance
Enhance recoil
https://github.com/qquanwei/recoil-enhance
Last synced: 14 days ago
JSON representation
Enhance recoil
- Host: GitHub
- URL: https://github.com/qquanwei/recoil-enhance
- Owner: Qquanwei
- License: mit
- Created: 2022-09-27T01:50:14.000Z (about 2 years ago)
- Default Branch: master
- Last Pushed: 2024-10-27T08:41:56.000Z (2 months ago)
- Last Synced: 2024-10-27T09:46:09.453Z (2 months ago)
- Language: TypeScript
- Size: 283 KB
- Stars: 1
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
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.