({ userId })
| 27 | ) |
| 28 | |
| 29 | const User = ({ userId }) => { |
| 30 | const state = useAsync({ |
| 31 | suspense: true, |
| 32 | promiseFn: loadUser, |
| 33 | debugLabel: `User ${userId}`, |
| 34 | userId, |
| 35 | }) |
| 36 | return ( |
| 37 | <> |
| 38 | <IfFulfilled state={state}>{data => <UserDetails data={data} />}</IfFulfilled> |
| 39 | <IfRejected state={state}>{error => <p>{error.message}</p>}</IfRejected> |
| 40 | </> |
| 41 | ) |
| 42 | } |
| 43 | |
| 44 | export const App = () => ( |
| 45 | <> |
nothing calls this directly
no test coverage detected