Query Docs
Examples
- Simple
- Basic
- Basic w/ GraphQL-Request
- Default Query Function
- Solid Start
- Astro
- Offline Queries and Mutations
- Playground
- Algolia
- Chat example (streaming)
- Shadow DOM
- Devtools Embedded Panel
- Star Wars
- Rick And Morty
- Solid Router
- Suspense
- Batching
- Auto Refetching / Polling / Realtime
- Optimistic Updates
- Pagination
- Prefetching
Solid Example: Optimistic Updates
import { ErrorBoundary, Suspense } from 'solid-js'
import ApproachTabs from '~/components/ApproachTabs'
export default function Home() {
return (
<main
style={{ 'max-width': '600px', margin: '0 auto', padding: '2rem 1rem' }}
>
<h1>Optimistic Updates with TanStack Query</h1>
<p style={{ color: '#666', 'margin-bottom': '1.5rem' }}>
Add todos to see optimistic updates in action. The server randomly fails
~30% of the time so you can observe automatic rollback.
</p>
<ErrorBoundary
fallback={(error) => <p style={{ color: 'red' }}>{error.message}</p>}
>
<Suspense fallback={<p>Loading todos…</p>}>
<ApproachTabs />
</Suspense>
</ErrorBoundary>
</main>
)
}