This repository contains a collection of React applications demonstrating various patterns and best practices in modern React development. Each project is built with TypeScript, Vite, and follows current React practices.
-
Context Pattern (
my-react-context-app/
)- Demonstrates the React Context API
- Shows how to create and use custom hooks
- Implements a notification system pattern
-
Redux Pattern (
my-react-redux-app/
)- Showcases Redux Toolkit integration
- Implements a Todo application with full CRUD operations
- Demonstrates proper Redux state management patterns
-
React Router Pattern (
my-react-router-app/
)- Shows routing in React applications
- Implements protected routes
- Demonstrates navigation and route parameters
-
TanStack Query Pattern (
my-react-tanstack-query-app/
)- Shows data fetching with TanStack Query (formerly React Query)
- Implements pagination
- Demonstrates proper cache management
-
Zustand Pattern (
my-react-zustand-app/
)- Shows state management with Zustand
- Demonstrates a lightweight alternative to Redux
- Implements persistent storage
-
State Machine Pattern (
my-state-machine-app/
)- Demonstrates state management using state machines
- Shows complex state flows
- Implements a wizard-like interface
-
useReducer Pattern (
my-use-reducer-app/
)- Shows local state management with useReducer
- Implements a Todo application
- Demonstrates type-safe actions and reducers
Each project is self-contained and can be run independently. To try any project:
-
Navigate to the project directory:
cd <project-folder>
-
Install dependencies:
npm install
-
Start the development server:
npm run dev
-
Open your browser and navigate to
http://localhost:5173
- React 18
- TypeScript
- Vite
- ESLint
- Various state management libraries (Redux, Zustand, etc.)
- React Router
- TanStack Query
If you're new to React patterns, we recommend following this order:
- Start with the useReducer pattern to understand basic state management
- Move to the Context pattern to learn about state sharing
- Explore the Redux pattern for global state management
- Try the Zustand pattern for a simpler global state alternative
- Learn routing with the React Router pattern
- Master data fetching with the TanStack Query pattern
- Explore complex state flows with the State Machine pattern
Feel free to contribute by:
- Adding new patterns
- Improving existing implementations
- Fixing bugs
- Enhancing documentation
MIT - Feel free to use this in your own projects