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

Function User

examples/with-suspense/src/index.js:29–42  ·  view source on GitHub ↗
({ userId })

Source from the content-addressed store, hash-verified

27)
28
29const 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
44export const App = () => (
45 <>

Callers

nothing calls this directly

Calls 1

useAsyncFunction · 0.90

Tested by

no test coverage detected