@react-web/promise-view
v0.2.4
Published
## Usage
Downloads
3
Readme
@react-web/promise-view
Usage
import PromiseView from '@react-web/promise-view'
// or
// import { PromiseView } from '@react-web/components'
render(
<PromiseView promise={Promise.resolve('success')}>
{(state, result) => {
if (state === 'resolved') return <div>Data: {result}</div>
if (state === 'rejected') return <div>Error: {result.message}</div>
if (state === 'pending') return <div>Loading...</div>
return null
}}
</PromiseView>
)