()
| 164 | } |
| 165 | |
| 166 | function App() { |
| 167 | const [state, setState] = useState(1) |
| 168 | const [win, setWin] = useState<Window | null>(null) |
| 169 | const [postId, setPostId] = useState(-1) |
| 170 | return ( |
| 171 | <div> |
| 172 | <Context.Provider value={{ count: state, setCount: setState }}> |
| 173 | <QueryClientProvider client={queryClient}> |
| 174 | <h1>TanStack Devtools React Basic Example</h1> |
| 175 | current count: {state} |
| 176 | <Button onClick={() => setState(state + 1)}>Click me</Button> |
| 177 | <Button onClick={() => setWin(window.open('', '', 'popup'))}> |
| 178 | Click me to open new window |
| 179 | </Button> |
| 180 | {win && createPortal(<Mounted />, win.document.body)} |
| 181 | <Feature /> |
| 182 | <p> |
| 183 | As you visit the posts below, you will notice them in a loading |
| 184 | state the first time you load them. However, after you return to |
| 185 | this list and click on any posts you have already visited again, you |
| 186 | will see them load instantly and background refresh right before |
| 187 | your eyes!{' '} |
| 188 | <strong> |
| 189 | (You may need to throttle your network speed to simulate longer |
| 190 | loading sequences) |
| 191 | </strong> |
| 192 | </p> |
| 193 | {postId > -1 ? ( |
| 194 | <Post postId={postId} setPostId={setPostId} /> |
| 195 | ) : ( |
| 196 | <Posts setPostId={setPostId} /> |
| 197 | )} |
| 198 | <Devtools /> |
| 199 | </QueryClientProvider> |
| 200 | </Context.Provider> |
| 201 | </div> |
| 202 | ) |
| 203 | } |
| 204 | |
| 205 | const root = createRoot(document.getElementById('root')!) |
| 206 | root.render(<App />) |
nothing calls this directly
no test coverage detected