2.5.2 • Published 2 months ago
sz-react-support v2.5.2
sz-react-support
npm install --save sz-react-support
Usage
useAsyncState
useAsyncState is the most powerful feature of this library. It give us the best way to manage async state in react.
function Component() {
const { state } = useAsyncState({
loader: async () => await (await fetch("/api/foo/")).json(),
reloadOnMounted: true,
});
return <div>{state}</div>;
}