https://github.com/egeuysall/learn-tanstack
Learn. Fetch. Mutate
https://github.com/egeuysall/learn-tanstack
backend frontend javascript learn tanstack-query typescript
Last synced: 5 months ago
JSON representation
Learn. Fetch. Mutate
- Host: GitHub
- URL: https://github.com/egeuysall/learn-tanstack
- Owner: egeuysall
- License: gpl-3.0
- Created: 2025-10-18T01:47:13.000Z (8 months ago)
- Default Branch: master
- Last Pushed: 2025-11-22T14:53:09.000Z (7 months ago)
- Last Synced: 2025-11-22T16:29:19.698Z (7 months ago)
- Topics: backend, frontend, javascript, learn, tanstack-query, typescript
- Language: TypeScript
- Homepage:
- Size: 120 KB
- Stars: 1
- Watchers: 0
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
- Code of conduct: CODE_OF_CONDUCT.md
- Security: SECURITY.md
Awesome Lists containing this project
README
# Learn TanStack Query
A hands-on learning project built to master state management with Zustand and server state with TanStack Query.
## What I Learned
### Zustand
- Basic state management with `set` and `get`
- Persistent state with `persist` middleware
- Store communication (stores talking to each other)
- When to use Zustand vs useState vs TanStack Query
- Performance optimization with `useShallow`
### TanStack Query
- Fetching data with `useQuery`
- Mutations (POST/PUT/DELETE) with `useMutation`
- Cache invalidation with `invalidateQueries`
- Loading and error states
- Query keys for caching and refetching
- Pagination with dynamic query keys
### Architecture Decisions
- **TanStack Query** → Server state (API data, caching)
- **Zustand** → Client state (UI state, pagination, preferences)
- **useState** → Local/temporary state (forms, modals)
## Project Features
- Blog listing with pagination
- Admin panel to create new blogs
- Real API integration with JWT authentication
- Automatic cache updates after mutations
## Tech Stack
- Next.js 15
- TypeScript
- TanStack Query
- Zustand
- Tailwind CSS
## Key Takeaways
- State management isn't one-size-fits-all
- Use the right tool for the right job
- Server state ≠ Client state
- Performance matters (useShallow, proper selectors)
- Environment variables for secrets (never commit tokens!)