Documentation
Docs
Introduction
Getting Started
Tutorial: build an app
Core Concepts
Routing
Server-Side Rendering
Mimir, state management
Pages & Layouts
API Routes
Styling & Theming
Building & Deploying
API Reference
Guides
Recipes
FAQ (use cases)
Recipe , pagination
Paginate a list using the query string for the page number, the router to navigate, and an atom (or server-known data) for the items. This keeps pages shareable (the URL carries the state) and navigation instant.
State in the URL
The page number belongs in the query string (?page=2), not in component state, so a paginated view is
shareable, bookmarkable, and survives reloads for free.
Server-side slice (cached pages per page)
If the data is server-known, you can register a static route per page number so each page of results is fully server-rendered and cached, great for SEO on a blog index:
The component reads the page from the path/query and slices allPosts(). Each /blog/page/N is its own
cached, indexable URL. See Programmatic routes.
Client-side slice (live or per-user data)
For data fetched after hydration, keep the items and the page in atoms and slice on the client, or fetch the
page from an API that supports ?page:
A pager that uses the router
Because it uses navigate, clicking a page is a client navigation: the URL updates, the list re-slices,
no full reload, and any other state (filters, scroll) is preserved.
Server-paginated API (large datasets)
For datasets too large to ship to the client, paginate in the API and fetch per page:
Choosing
| Data | Approach |
|---|---|
| Server-known, SEO matters | one cached route per page (/blog/page/N) |
| Bundled/embedded, modest size | client slice from an atom, URL holds the page |
| Large / per-user | API with ?page, fetch per page into an atom |
That completes the Recipes, and the documentation. Browse any chapter from the sidebar, or start over with the Tutorial.