sz-react-support
v2.5.2
Published
Seymour Zhang's React Supporting Library
Downloads
46
Readme
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>;
}