https://github.com/gaplo917/react-suspendable-contract
[Experimental] Simply fulfill the Suspense Component contract without re-writing existing components
https://github.com/gaplo917/react-suspendable-contract
hoc hook react suspense
Last synced: 2 months ago
JSON representation
[Experimental] Simply fulfill the Suspense Component contract without re-writing existing components
- Host: GitHub
- URL: https://github.com/gaplo917/react-suspendable-contract
- Owner: gaplo917
- Created: 2020-09-17T02:20:13.000Z (over 4 years ago)
- Default Branch: master
- Last Pushed: 2020-09-23T21:13:44.000Z (over 4 years ago)
- Last Synced: 2025-03-18T13:23:32.538Z (3 months ago)
- Topics: hoc, hook, react, suspense
- Language: TypeScript
- Homepage:
- Size: 69.3 KB
- Stars: 1
- Watchers: 2
- Forks: 1
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# React Suspendable Contract
Enjoy React Suspense for async data fetching **without rewriting existing components**.This module provides a simple wrapper `` and a simple hook `useSuspendableData(..)` to fulfill the
Suspense data fetching contract.**\[Experimental]: React.Suspense for data fetching is under experimental mode! (even React 17.0)**
### Getting Start
```
yarn add react-suspendable-contract# OR
npm install --save react-suspendable-contract
```### Support
✅ Typescript support### Example
```
import { Suspendable, useSuspendableData } from 'react-suspendable-contract'const UserPage = ({ userId }) => {
const suspendableData = useSuspendableData(() => getUserAsync({ id: userId }), [userId])return (
}>
{data => }
)
}
```### License
MIT