react-use-polyfill
v0.1.0
Published
use(promise)
Downloads
1,218
Readme
react-use-polyfill
See experimental_use(promise) by acdlite · Pull Request #25084 · facebook/react
Installation
npm i react-use-polyfill
Usage
import { use } from "react-use-polyfill";
function Async(props: { promise: Promise<string> }) {
const value = use(props.promise);
return (
<div>{value}</div>
);
}
function App() {
const promise = Promise.resolve("Resolved");
return (
<Suspense fallback={<div>Fallback</div>} >
<Async promise={promise} />
</Suspense>
);
}
License
MIT