()
| 144 | } |
| 145 | |
| 146 | function App() { |
| 147 | const [state, setState] = useState(1) |
| 148 | const [win, setWin] = useState<Window | null>(null) |
| 149 | const [postId, setPostId] = useState(-1) |
| 150 | return ( |
| 151 | <div> |
| 152 | <Context.Provider value={{ count: state, setCount: setState }}> |
| 153 | <h1>TanStack Devtools Preact Basic Example</h1> |
| 154 | current count: {state} |
| 155 | <Button onClick={() => setState(state + 1)}>Click me</Button> |
| 156 | <Button onClick={() => setWin(window.open('', '', 'popup'))}> |
| 157 | Click me to open new window |
| 158 | </Button> |
| 159 | {win && render(<Mounted />, win.document.body)} |
| 160 | <Feature /> |
| 161 | <p> |
| 162 | As you visit the posts below, you will notice them in a loading state |
| 163 | the first time you load them. However, after you return to this list |
| 164 | and click on any posts you have already visited again, you will see |
| 165 | them load instantly and background refresh right before your eyes!{' '} |
| 166 | <strong> |
| 167 | (You may need to throttle your network speed to simulate longer |
| 168 | loading sequences) |
| 169 | </strong> |
| 170 | </p> |
| 171 | {postId > -1 ? ( |
| 172 | <Post postId={postId} setPostId={setPostId} /> |
| 173 | ) : ( |
| 174 | <Posts setPostId={setPostId} /> |
| 175 | )} |
| 176 | <Devtools /> |
| 177 | </Context.Provider> |
| 178 | </div> |
| 179 | ) |
| 180 | } |
| 181 | |
| 182 | render(<App />, document.getElementById('root')!) |
nothing calls this directly
no test coverage detected