MCPcopy Create free account
hub / github.com/async-library/react-async / User

Function User

examples/basic-hook/src/index.js:29–40  ·  view source on GitHub ↗
({ userId })

Source from the content-addressed store, hash-verified

27)
28
29const User = ({ userId }) => {
30 const state = useAsync({ promiseFn: loadUser, debugLabel: `User ${userId}`, userId })
31 return (
32 <>
33 <IfPending state={state}>
34 <UserPlaceholder />
35 </IfPending>
36 <IfFulfilled state={state}>{data => <UserDetails data={data} />}</IfFulfilled>
37 <IfRejected state={state}>{error => <p>{error.message}</p>}</IfRejected>
38 </>
39 )
40}
41
42export const App = () => (
43 <>

Callers

nothing calls this directly

Calls 1

useAsyncFunction · 0.90

Tested by

no test coverage detected