Use React Suspense today, with any data fetching library
npm install --save use-suspense-today
import * as React from 'react'
import { useSuspense } from 'use-suspense-today'
const Child = () => {
const { loading, data } = useApiThatIsNotSuspenseReady();
useSuspense(loading);
return <section>{data}</section>;
};
const Parent = () => {
return (
<React.Suspense fallback={<div>Loading...</div>}>
<Child />
</React.Suspense>
);
};
MIT © Hermanya
This hook is created using create-react-hook.