MCPcopy Index your code
hub / github.com/TanStack/query / Post

Function Post

examples/solid/basic-graphql-request/src/index.tsx:142–171  ·  view source on GitHub ↗
(props: { postId: number; setPostId: Setter<number> })

Source from the content-addressed store, hash-verified

140}
141
142function Post(props: { postId: number; setPostId: Setter<number> }) {
143 const state = createPost(() => props.postId)
144
145 return (
146 <div>
147 <div>
148 <a onClick={() => props.setPostId(-1)} href="#">
149 Back
150 </a>
151 </div>
152 <Switch>
153 <Match when={!props.postId || state.status === 'pending'}>
154 Loading...
155 </Match>
156 <Match when={state.status === 'error'}>
157 <span>Error: {(state.error as Error).message}</span>
158 </Match>
159 <Match when={state.data !== undefined}>
160 <>
161 <h1>{state.data?.title}</h1>
162 <div>
163 <p>{state.data?.body}</p>
164 </div>
165 <div>{state.isFetching ? 'Background Updating...' : ' '}</div>
166 </>
167 </Match>
168 </Switch>
169 </div>
170 )
171}
172
173render(() => <App />, document.getElementById('root') as HTMLElement)

Callers

nothing calls this directly

Calls 1

createPostFunction · 0.70

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…