examples/solid/star-wars-solid-router
| Name | Last commit message | Last commit date |
|---|---|---|
| .. | ||
README.md
TanStack Solid Query Star Wars Example (Solid Router)#
A multi-page Star Wars app with films and characters, where each page fetches its own data.
Built with Solid Router.
How it works#
src/services/characters/queries.ts,src/services/films/queries.tsandsrc/services/planets/queries.tsdefinelist()anddetail(id)factories withqueryOptions(planetsQueriesonly hasdetail(id)), keyed by['characters', ...],['films', ...]and['planets', ...]. The matchingapi.tsfiles fetch from SWAPI.src/App.tsxmaps each Solid Router route to a page component, and each page reads its own data withuseQuery:src/Characters.tsxandsrc/Films.tsxread the lists,src/Character.tsxandsrc/Film.tsxread a detail.src/Character.tsxrenders aFilmand aHomeworldcomponent per related id, each with its ownuseQuery, andsrc/Film.tsxdoes the same for characters. Details you have already opened come from the cache when you navigate back.
To run this example:
npm installnpm run dev