This repository is a step-by-step React learning path for a developer who starts as a newbie and wants to grow toward senior-level thinking.
The guide is split into sessions. Each session has:
- a goal
- what to learn
- hands-on steps
- expected output
- a suggested git commit message
- Study one session at a time.
- Build the sample code by yourself after reading the session.
- Commit your work when the session is complete.
- Do not rush to advanced topics before the basics are stable.
- Open PROJECT_STEP_BY_STEP.md to learn how this repository applies the roadmap in a real sample app.
- Session 1: Create and run a React project
- Session 2: Components, props, events, and reusable UI
- Session 3: Routing, layout, and page structure
- Session 4: State management, forms, and API basics
- Session 5: Response handling, authentication, force login, expired token
- Session 6: Advanced state optimization, MVVM, and scalable patterns
- Session 7: Linting, unit testing, and performance testing
- Session 8: Deploy, production readiness, and technical optimization
- React
- Vite
- React Router
- Axios
- React Hook Form
- Zod
- Zustand
- TanStack Query
- ESLint
- Prettier
- Vitest
- React Testing Library
- Lighthouse
Understand how a React project starts, how the folder structure works, and how to run the app locally.
- Node.js and npm
- what Vite does
src/main.jsxandsrc/App.jsx- development server
- build output
- Install Node.js LTS.
- Create a new project:
npm create vite@latest react-learning-app -- --template react
cd react-learning-app
npm install- Run the project:
npm run dev- Open the local URL shown in the terminal.
- Read the generated files:
index.htmlsrc/main.jsxsrc/App.jsx
- Change the page title and screen content.
- Stop the server and run a production build:
npm run build- Preview the build:
npm run preview- you can create a React project without copy-paste confusion
- you know the difference between
dev,build, andpreview - you understand where the app starts rendering
docs(session-1): add project setup and run guide for React + Vite
Learn how React UIs are built from small components and how to reuse them safely.
- component as a function
- JSX
- props
- event handling
- conditional render
- list render with
map - basic folder structure
- Create a
componentsfolder. - Start with simple UI parts:
ButtonInputCardHeader
- Pass data from parent to child with props.
- Add click events like
onClick. - Render a list of cards from an array.
- Add empty state UI when there is no data.
- Extract repeated JSX into a reusable component.
src/
components/
Button.jsx
Card.jsx
Input.jsx
pages/
App.jsx- use small components with one clear responsibility
- prefer clear prop names like
title,onSubmit,isLoading - avoid giant components with too much UI and logic mixed together
- you can break one screen into many small components
- you understand when to create a reusable component
- you know the difference between a page component and a shared component
docs(session-2): add beginner guide for components props events and reusable UI
Learn how to build a multi-page React app without refreshing the browser.
- client-side routing
- route params
- nested routes
- shared layout
- not found page
- Install React Router:
npm install react-router-dom- Create pages:
HomePageProductsPageProductDetailPageLoginPageNotFoundPage
- Create a root layout with header, sidebar, and footer.
- Configure routes with
createBrowserRouterorBrowserRouter. - Add a dynamic route like
/products/:id. - Use
LinkandNavLink. - Add a
404page.
src/
layouts/
MainLayout.jsx
pages/
HomePage.jsx
LoginPage.jsx
ProductsPage.jsx
ProductDetailPage.jsx
NotFoundPage.jsx
router/
index.jsx- keep route definition centralized
- separate layout from page content
- use route-based code splitting later for performance
- you can navigate between pages
- you can read route params
- you understand where to place shared layout code
docs(session-3): add routing layout and page structure guide
Understand how data changes in React and how the UI stays in sync with user input and server data.
useState- lifting state up
- controlled inputs
- loading and error state
- basic API request flow
- Start with local state:
- counter
- search input
- modal open and close
- Move shared state to the nearest common parent.
- Build a form with:
- name
- password
- Add validation with simple rules first.
- Install API helper libraries:
npm install axios react-hook-form zod @hookform/resolvers- Fetch data from a public API.
- Render:
- loading state
- success state
- empty state
- error state
- Learn the difference between server state and UI state.
Do not put everything in one global store. New developers often over-share state too early.
- call API
- show loading
- receive data
- normalize only if needed
- update UI
- handle error clearly
- you know when local state is enough
- you can submit forms and validate user input
- you can connect a page to an API
docs(session-4): add state forms and api basics guide
Build a safer frontend that behaves correctly when the backend returns success, business errors, unauthorized access, or expired tokens.
- HTTP status codes
- access token and refresh token
- protected route
- request interceptor
- response interceptor
- Define a clear API module:
api/client.jsapi/auth.jsapi/user.js
- Store tokens in a controlled way.
- Add Axios interceptors:
- attach token before request
- catch
401 Unauthorized - redirect to login when refresh fails
- Create a protected route wrapper.
- Handle response states:
200: show data400: show validation message401: try refresh or force login403: show permission denied500: show fallback error UI
- Clear sensitive state when logout happens.
- user opens protected page
- app sends request with access token
- backend returns
401 - app tries refresh token once
- if refresh works, retry original request
- if refresh fails, clear session and navigate to
/login
Do not retry forever. Infinite retry loops are a common production bug.
src/
api/
client.js
auth.js
guards/
ProtectedRoute.jsx
services/
tokenService.js- you can design a clean login flow
- you know how to react to expired sessions
- you can protect routes and show the right error state
docs(session-5): add authentication response handling and token expiry guide
Move from feature coding into maintainable architecture and performance-aware state design.
- global state vs local state
- derived state
- memoization
- selector pattern
- View and ViewModel separation
- Split state types:
- local UI state
- shared client state
- server state
- Use Zustand for lightweight client state when needed:
npm install zustand- Use TanStack Query for server state:
npm install @tanstack/react-query- Avoid duplicated state:
- do not copy server data into many local states
- prefer selectors and derived values
- Introduce MVVM:
- View: UI only
- ViewModel: page logic, actions, derived data
- Model: API types, mappers, domain rules
src/
modules/
users/
components/
pages/
view-models/
services/
models/- reusable components should be generic, not tied to one business screen
- business logic should stay outside shared UI
- prefer composition over too many boolean props
- colocate state near where it is used
- avoid prop drilling when context or store is truly needed
- use selectors to reduce unnecessary rerenders
- debounce search input
- lazy load heavy routes
- split code by feature
- you can decide where state should live
- you can separate screen UI from business logic
- you understand how to scale a React codebase with less chaos
docs(session-6): add mvvm reusable component and state optimization guide
Learn how to protect quality before bugs reach production.
- lint vs format
- unit test vs integration test
- component test
- performance measurement
- Install quality tools:
npm install -D eslint prettier vitest @testing-library/react @testing-library/jest-dom jsdom- Add lint rules for:
- unused imports
- inconsistent style
- hooks rules
- Create tests for:
- render component
- button click
- form validation
- loading and error state
- Test a custom hook if it contains business logic.
- Run tests in watch mode while coding.
- Measure performance with:
- React DevTools Profiler
- Lighthouse
- browser Performance tab
- utility functions
- form behavior
- API error state rendering
- auth redirect behavior
- important reusable components
- large rerender chains
- too much state at high tree levels
- expensive list rendering
- fetching the same data many times
- bundle size growing without control
- you can enforce code quality with linting
- you can write useful tests instead of only snapshot tests
- you can find slow screens with proper tools
docs(session-7): add lint unit test and performance testing guide
Understand how a React app moves from local development to a production environment.
- environment variables
- build command
- static hosting
- CI basics
- monitoring and logging
- Prepare environment files:
.env.development.env.production
- Build the app:
npm run build- Deploy to one platform first:
- Vercel
- Netlify
- AWS S3 + CloudFront
- Add SPA route fallback configuration.
- Confirm:
- refresh still works on nested routes
- API base URL is correct
- source maps and secrets are handled safely
- Add CI ideas:
- install dependencies
- run lint
- run test
- run build
- Add monitoring later:
- error tracking
- analytics
- web vitals
- use route-level code splitting
- use image optimization
- virtualize long lists
- cache server state smartly
- prevent duplicate requests
- use skeleton loading for better UX
- keep bundle dependencies under review
- remove dead code and unused UI libraries
- document feature boundaries
- prefer consistent patterns over clever shortcuts
You can learn faster with a UI library, but choose it carefully.
- for fast admin UI: Ant Design, MUI
- for flexible headless patterns: Radix UI, Headless UI
- for utility-first styling: Tailwind CSS
Rule for senior engineers:
- do not let the UI library control the whole architecture
- wrap third-party UI in your own shared components when needed
- run project
- build components
- understand props and state
- call API
- handle loading and error
- routing
- auth flow
- shared hooks
- reusable components
- testing
- code organization
- architecture decisions
- state boundaries
- performance strategy
- design system thinking
- deployment safety
- maintainability over time
- Build a small CRUD app.
- Add login and protected routes.
- Add reusable form components.
- Add React Query and optimize server state.
- Refactor one feature into MVVM style.
- Add tests and lint rules.
- Deploy to production.
- Review performance and bundle size.
- learn fundamentals before chasing advanced libraries
- do not treat every problem as a global state problem
- do not optimize too early, but always measure before optimizing
- keep commits small and meaningful
- write code that the next teammate can understand quickly
This repository now includes a GitHub Actions workflow for GitHub Pages deployment.
- Push this repository to GitHub.
- Open repository
Settings. - Open
Pages. - Set
SourcetoGitHub Actions. - Push to
mainto trigger deployment.
The app uses HashRouter so page navigation still works correctly on GitHub Pages without server-side route rewrites.
docs(session-8): add deployment roadmap and senior optimization guidance