@audi2014/react-async-concurrent
v1.0.24
Published
This is dummy package. This repository was created for exploring github packages functionality
Downloads
11
Maintainers
Readme
react-async-concurrent
Dummy package for declarative(JSX) sequential promise execution
...
<Async promiseFn={promiseFn}>{render}</Async> // this promiseFn starts at first
<Async promiseFn={promiseFn}>{render}</Async> // starts after finishing first
<Async promiseFn={promiseFn}>{render}</Async> // starts after finishing seccond
...
Index
Async
Component (wrapper) which will put promise result into children (FaCC) or renderResult function
Props
- renderPending ({status:
pending
}) - optional callback for renderingpending
status: (promiseFn was not called or canceled. Component is waiting for finishing other concurrent promises) - renderProgress ({status:
progress
}) - optional callback for renderingprogress
status: (promiseFn was called but promise did not fulfilled yet) - renderError ({error, status:
error
}) - optional callback for renderingerror
status: (promiseFn promise throws error) - promiseFn - function callback that should create new promise. will be called if all child promises resolved. supports cancelable promises such as cancelable-promise
- children - FaCC with arguments {lastResult/result:"Awaited result of promiseFn", status:
pending
|progress
|error
|result
} if children is set - renderers renderPending/renderProgress/renderError/renderResult will be ignored - asyncStart - do not wait for finishing concurrent promises. call promiseFn immediately
- asyncChildren - children will have parallel concurrent context
- awaited - promiseFn will not block other concurrent promises
Example
https://qz8j6h.csb.app/
Bugs
- React.StrictMode runs all promiseFn at first render in codesandbox env
subpath imports support (ESM/CommonJs)