Open History to see the last commit
1import { Match, Switch } from 'solid-js'
2import { useQuery } from '@tanstack/solid-query'
3β
4const App = () => {
5 const query = useQuery(() => ({
6 queryKey: ['test'],
7 queryFn: async () => {
8 await new Promise((r) => setTimeout(r, 1000))
9 return 'Success'
10 },
11 }))
12β
13 return (
14 <Switch>
15 <Match when={query.isPending}>Loading...</Match>
16 <Match when={query.isError}>An error has occurred!</Match>
17 <Match when={query.isSuccess}>{query.data}</Match>
18 </Switch>
19 )
20}
21β
22export default App