MCPcopy Create free account
hub / github.com/TanStack/devtools / App

Function App

examples/react/basic/src/index.tsx:166–203  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

164 )
165}
166
167function App() {
168 const [state, setState] = useState(1)
169 const [win, setWin] = useState<Window | null>(null)
170 const [postId, setPostId] = useState(-1)
171 return (
172 <main className="example-shell">
173 <Context.Provider value={{ count: state, setCount: setState }}>
174 <QueryClientProvider client={queryClient}>
175 <header className="example-header">
176 <p className="example-eyebrow">TanStack Devtools</p>
177 <h1>React basic example</h1>
178 <p>
179 Explore cached posts, plugin panels, and the development-only
180 accessibility fixture in one focused sandbox.
181 </p>
182 </header>
183 <section
184 className="example-card example-actions"
185 aria-label="Example controls"
186 >
187 <p>
188 Current count <strong>{state}</strong>
189 </p>
190 <div className="example-button-row">
191 <Button onClick={() => setState(state + 1)}>
192 Increment count
193 </Button>
194 <Button onClick={() => setWin(window.open('', '', 'popup'))}>
195 Open a new window
196 </Button>
197 </div>
198 </section>
199 {win && createPortal(<Mounted />, win.document.body)}
200 <section className="example-card example-content">
201 <Feature />
202 <p>
203 As you visit the posts below, you will notice them in a loading
204 state the first time you load them. However, after you return to
205 this list and click on any posts you have already visited again,
206 you will see them load instantly and background refresh right

Callers

nothing calls this directly

Calls 1

setStateFunction · 0.85

Tested by

no test coverage detected