A comprehensive learning resource for React Hooks with beautiful documentation, practical examples, and interactive demos. Perfect for developers preparing for interviews or mastering React fundamentals.
This repository is a dual-purpose learning platform that combines:
- π Beautiful Documentation Site - Built with VitePress featuring comprehensive notes on all React Hooks
- βοΈ Interactive React Application - Built with Vite + React 19 + TypeScript for hands-on examples
- Educational Resource: Master all React Hooks from basic to advanced
- Interview Preparation: Concise notes with common Q&A patterns
- Practical Examples: Runnable code examples for each hook
- Modern Setup: Latest React 19 features with TypeScript support
- Beautiful UI: Custom-styled documentation with responsive design
# Start React application (Interactive examples) npm run dev # β http://localhost:5173 # Start documentation site npm run docs:dev # β http://localhost:5174 # Run both simultaneously (recommended) npm run dev & npm run docs:devEach hook documentation includes:
- π Quick Summary: Concise overview with key points
- π§ Mental Model: Conceptual understanding of how the hook works
- π Key Concepts: Essential patterns and use cases
- π» Code Examples: Practical, runnable examples with explanations
β οΈ Common Pitfalls: What to avoid and why- β Best Practices: Professional patterns and recommendations
- β Interview Q&A: Common interview questions with detailed answers
| Hook | Description | Documentation Link |
|---|---|---|
useState | State management | π useState.md |
useEffect | Side effects & lifecycle | π useEffect.md |
useLayoutEffect | Synchronous DOM effects | π useLayoutEffect.md |
useRef | References & imperatives | π useRef.md |
useContext | Context consumption | π useContext.md |
useReducer | Complex state logic | π useReducer.md |
| Hook | Description | Documentation Link |
|---|---|---|
useMemo | Value memoization | π useMemo.md |
useCallback | Function memoization | π useCallback.md |
useId | Unique identifier generation | π useId.md |
| Hook | Description | Documentation Link |
|---|---|---|
useImperativeHandle | Imperative APIs | π useImperativeHandle.md |
useTransition | Concurrent rendering | π useTransition.md |
useDeferredValue | Deferred updates | π useDeferredValue.md |
| Hook | Description | Documentation Link |
|---|---|---|
useActionState | Form action state management | π useActionState.md |
useFormStatus | Form submission status | π useFormStatus.md |
useOptimistic | Optimistic UI updates | π useOptimistic.md |
| Topic | Description | Documentation Link |
|---|---|---|
| Custom Hooks | Patterns for reusable logic | π customHooks.md |
| Resource | Description | Link |
|---|---|---|
| Overview | All hooks with beautiful cards | π Hooks Overview |
| Homepage | Documentation site homepage | π Homepage |
react-hooks/ βββ π docs/ # VitePress Documentation Site β βββ π .vitepress/ # VitePress configuration β β βββ π config.ts # Site config, navigation, SEO β β βββ π theme/ # Custom theme β β βββ π index.ts # Theme entry point β β βββ π custom.css # Custom styling (cards, gradients, etc.) β βββ π hooks/ # Hook documentation β β βββ π index.md # Hooks overview with beautiful cards β β βββ π 01_useState.md # State management hook β β βββ π 02_useEffect.md # Side effects hook β β βββ π 03_useLayout.md # Layout effect hook β β βββ π 04_useRef.md # Reference hook β β βββ π 05_useContext.md # Context consumption hook β β βββ π 06_useReducer.md # State reducer hook β β βββ π 07_useMemo.md # Memoization hook β β βββ π 08_useCallback.md # Callback memoization hook β β βββ π 09_useImperativeHandle.md # Imperative API hook β β βββ π 10_useId.md # Unique ID generation hook β β βββ π 11_useTransition.md # Concurrent rendering hook β β βββ π 12_useDeferredValue.md # Deferred value hook β β βββ π 13_useActionState.md # Form action state hook (React 19) β β βββ π 14_useFormStatus.md # Form status hook (React 19) β β βββ π 15_useOptimistic.md # Optimistic updates hook (React 19) β β βββ π 16_customHooks.md # Custom hooks patterns β βββ π public/ # Static assets for docs β β βββ π logo.svg # React logo β βββ π index.md # Homepage with hero section βββ π src/ # React Application Source β βββ π hooks/ # Hook implementations & examples β β βββ π useState/ # useState examples β β βββ π UseState.tsx # Main useState component β β βββ π examples/ # Practical examples β β βββ π CounterBasic.tsx # Basic counter β β βββ π LazyInit.tsx # Lazy initialization β βββ π App.tsx # Main React application β βββ π App.css # Application styles β βββ π main.tsx # React app entry point β βββ π index.css # Global styles β βββ π vite-env.d.ts # Vite type definitions βββ π public/ # React app static assets β βββ π vite.svg # Vite logo βββ π package.json # Dependencies & scripts βββ π vite.config.ts # Vite configuration βββ π tsconfig.json # TypeScript configuration βββ π tsconfig.app.json # App-specific TypeScript config βββ π tsconfig.node.json # Node.js TypeScript config βββ π eslint.config.js # ESLint configuration βββ π index.html # React app HTML template βββ π README.md # This file Ayush Gupta
- GitHub: @ayush-gupta07
- LinkedIn: ayushgupta001
Made with β€οΈ for the React community
Star β this repository if it helped you learn React Hooks!