A Spectacle presentation about React Query with live editable code examples and a real API server.
- 🎯 Live Code Examples - Edit React Query code in real-time
- 🚀 Real API Server - File-based todo API for demonstrations
- 💾 File Storage - Todos are persisted to
todos.json
- 🎨 Beautiful UI - Modern styling with Spectacle
- ⚡ Hot Reload - Instant updates during development
# Install dependencies
npm install
# Start both server and presentation
npm run dev:full
This will start:
- Todo API server on
http://localhost:3011
- Presentation on
http://localhost:3010
# Terminal 1: Start the API server
npm run server
# Terminal 2: Start the presentation
npm run dev
The server provides a RESTful API for todos:
GET /api/todos
- Get all todos (with optional pagination)POST /api/todos
- Create a new todoPUT /api/todos/:id
- Update a todoDELETE /api/todos/:id
- Delete a todoGET /api/health
- Health check
# Get all todos
curl http://localhost:3011/api/todos
# Create a new todo
curl -X POST http://localhost:3011/api/todos \
-H "Content-Type: application/json" \
-d '{"title": "New Todo", "completed": false}'
# Get paginated todos
curl "http://localhost:3011/api/todos?page=0&limit=5"
Todos are stored in todos.json
in the project root. The file is automatically created with sample data when the server starts.
npm start
- Start the presentation onlynpm run dev
- Start the presentation in development modenpm run server
- Start the API server onlynpm run dev:full
- Start both server and presentationnpm run build
- Build for production
- Frontend: React, Spectacle, React Live
- Data Fetching: TanStack React Query v5
- Backend: Express.js
- Storage: File-based JSON storage
- Build Tool: Webpack
The presentation covers:
- Introduction to React Query
- Basic Queries - Fetching data with
useQuery
- Mutations - Updating data with
useMutation
- Infinite Queries - Pagination and infinite scrolling
- Key Features - Caching, background updates, etc.
- Setup Instructions
- Best Practices
Each section includes live, editable code examples that connect to the real API server.