Skip to content
Justice Tech School

React Tutorial

Build interactive user interfaces with components, state and hooks.

Start learning React
Getting started6 lessons
  1. 1React IntroductionReact is a JavaScript library for building user interfaces from small reusable pieces call.
  2. 2React Get StartedThe quickest way to start is a build tool such as Vite.
  3. 3JSX SyntaxJSX looks like HTML inside JavaScript.
  4. 4JSX ExpressionsAny JavaScript expression goes inside curly braces: variables, math, function calls and te.
  5. 5Fragments and RenderingA component returns one root.
  6. 6Project StructureA Vite project has index.html, src/main.jsx which mounts the app, src/App.jsx and a compon.
Components8 lessons
  1. 7Function ComponentsA component is a function that starts with a capital letter and returns JSX.
  2. 8PropsProps pass data from a parent to a child, like function arguments.
  3. 9Children and CompositionThe special children prop holds whatever is placed between the tags.
  4. 10Conditional RenderingRender different UI with ternaries, && or early returns.
  5. 11Lists and KeysUse map to turn an array into elements.
  6. 12Styling ComponentsStyle with className and a CSS file, with the style prop taking an object of camelCase pro.
  7. 13Importing and Exporting ComponentsPut each component in its own file, export it and import it where needed.
  8. 14Pure ComponentsA pure component returns the same JSX for the same props and state and does not change out.
State and events19 lessons
  1. 15Handling EventsPass a function to props such as onClick and onChange.
  2. 16The useState HookuseState gives a component memory.
  3. 17State Updates and SnapshotsState is a snapshot for each render.
  4. 18State with Objects and ArraysNever mutate state.
  5. 19Controlled InputsA controlled input shows a value from state and updates it in onChange.
  6. 20Lifting State UpWhen two components need the same data, move the state to their closest common parent and .
  7. 21Forms and SubmitHandle onSubmit on the form, call preventDefault to stop the page reload and read values f.
  8. 22useStateuseState returns the value and a setter.
  9. 23Functional UpdatesWhen the next value depends on the previous one, pass a function.
  10. 24State with ObjectsNever mutate state.
  11. 25State with ArraysUse map, filter and spread to add, change and remove items.
  12. 26Handling EventsHandlers are camelCase props that receive a synthetic event.
  13. 27Passing Arguments to HandlersWrap the call in an arrow function to pass arguments.
  14. 28Controlled InputsA controlled input gets value from state and updates it on change.
  15. 29Checkboxes and SelectsUse checked for checkboxes and value for selects.
  16. 30Forms and SubmitCollect values in state and submit with onSubmit.
  17. 31Lifting State UpMove shared state to the nearest common parent and pass it down.
  18. 32Lazy Initial StatePass a function to useState to run expensive setup only once.
  19. 33Resetting State with keyChanging a key remounts a component and resets its state.
Lists and forms6 lessons
  1. 34Checkbox, Select and TextareaCheckboxes use checked, selects and textareas use value.
  2. 35A Todo ListCombine state, a list and events.
  3. 36Derived ValuesDo not store what you can calculate.
  4. 37Form ValidationValidate on submit or as the user types.
  5. 38Keys and Resetting StateA different key makes React treat the element as new, so its state resets.
  6. 39Sorting and Filtering ListsCopy before sorting because sort mutates.
Effects and refs7 lessons
  1. 40The useEffect HookuseEffect runs code after render to sync with outside systems such as timers, subscription.
  2. 41Effect CleanupReturn a function from an effect to clean up timers and listeners.
  3. 42Fetching DataFetch in an effect, store the result in state and handle loading and error states.
  4. 43The useRef HookuseRef holds a mutable value that survives renders without causing one.
  5. 44You Might Not Need an EffectAvoid effects for things you can compute while rendering or handle in an event.
  6. 45Strict Mode and Development ChecksStrictMode runs components twice in development to reveal impure code and missing cleanups.
  7. 46Routing with React RouterReact Router maps URLs to components without reloading.
Advanced ReactPremium11 lessons
  1. 47useReduceruseReducer manages complex state with a reducer function that takes state and an action an.
  2. 48ContextContext passes data through the tree without prop drilling.
  3. 49useMemo and useCallbackuseMemo caches a calculated value and useCallback caches a function between renders.
  4. 50React.memomemo skips re-rendering a component when its props did not change.
  5. 51Custom HooksA custom hook is a function starting with use that calls other hooks.
  6. 52Rules of HooksCall hooks only at the top level of components or custom hooks, never inside loops, condit.
  7. 53Lazy Loading with SuspenseReact.lazy loads a component only when needed and Suspense shows a fallback while it loads.
  8. 54Error BoundariesAn error boundary catches errors in its children while rendering and shows a fallback inst.
  9. 55Portals and forwardRefcreatePortal renders children into another DOM node such as document.body, useful for moda.
  10. 56useId, useTransition and useDeferredValueuseId makes stable ids for labels.
  11. 57Server Components and FrameworksServer Components render on the server and send HTML and data, so less JavaScript reaches .
React in practicePremium9 lessons
  1. 58Choosing State ManagementStart with local state, lift it up and use context for rarely changing values.
  2. 59Testing ComponentsTest what users see and do with React Testing Library and a runner such as Vitest.
  3. 60Performance TipsMeasure with the React DevTools profiler first.
  4. 61AccessibilityUse semantic elements, label every input, manage focus after navigation, add alt text and .
  5. 62React with TypeScriptType props with an interface or type.
  6. 63Project OrganisationGroup by feature rather than type: each feature folder holds its components, hooks and tes.
  7. 64Environment, Build and DeployVite exposes variables that start with VITE_.
  8. 65React Best PracticesKeep components small and pure, lift state only as high as needed, avoid effects for deriv.
  9. 66Next StepsBuild a small project such as a todo app, a weather app and a shop.
React basics11 lessons
  1. 67JSX RulesJSX must return one root element, close every tag and use className instead of class.
  2. 68Expressions in JSXCurly braces embed any JavaScript expression in markup.
  3. 69FragmentsA fragment groups siblings without adding a DOM node.
  4. 70Inline StylesThe style prop takes an object with camelCase keys.
  5. 71Conditional RenderingUse ternaries and && to show content conditionally.
  6. 72Lists and Keysmap builds lists.
  7. 73Function ComponentsA component is a function that returns JSX.
  8. 74PropsProps pass data from parent to child.
  9. 75The children PropAnything between tags arrives as children.
  10. 76Spreading PropsThe spread operator forwards an object as props.
  11. 77Import and ExportSplit components into files with default and named exports.
Hooks in depth13 lessons
  1. 78useEffectuseEffect runs after render for side effects like fetching or timers.
  2. 79Effect CleanupReturn a function to clean up timers and listeners.
  3. 80Fetching in an EffectLoad data in an effect and guard against stale responses.
  4. 81Dependency RulesList every reactive value the effect uses.
  5. 82useRefuseRef holds a mutable value that does not trigger renders and can point to a DOM node.
  6. 83useMemouseMemo caches a calculated value until dependencies change.
  7. 84useCallbackuseCallback keeps a function identity stable between renders.
  8. 85useReduceruseReducer manages complex state with a reducer function.
  9. 86ContextContext passes data deep without prop drilling.
  10. 87Custom HooksA custom hook is a function starting with use that calls other hooks.
  11. 88Rules of HooksCall hooks only at the top level of components or custom hooks.
  12. 89useId and useLayoutEffectuseId makes stable ids.
  13. 90useTransitionuseTransition marks updates as non urgent so typing stays smooth.
Components and patterns11 lessons
  1. 91Composition over InheritanceBuild UIs by combining components, not extending them.
  2. 92Render PropsPass a function as a prop to share rendering logic.
  3. 93Higher Order ComponentsA HOC wraps a component and returns an enhanced one.
  4. 94PortalscreatePortal renders children into another DOM node.
  5. 95Error BoundariesA class with getDerivedStateFromError catches render errors below it.
  6. 96lazy and Suspenselazy loads a component on demand and Suspense shows a fallback.
  7. 97React.memomemo skips re-rendering when props are unchanged.
  8. 98Refs to ChildrenPass a ref to a child so the parent can reach its DOM node.
  9. 99Typing PropsDocument props with TypeScript or PropTypes.
  10. 100Container and PresentationalSeparate data logic from display components.
  11. 101Compound ComponentsRelated components share state through context.
Real world React21 lessons
  1. 102Conditional ClassesBuild class names from state.
  2. 103Routing BasicsA router maps URLs to components.
  3. 104Route ParametersuseParams reads dynamic URL parts.
  4. 105Loading and Error StatesTrack status so the UI always shows something.
  5. 106Debouncing InputWait for the user to pause before running a costly action.
  6. 107Persisting StateSync state to localStorage with an effect.
  7. 108Theme SwitcherCombine context and state for a theme toggle.
  8. 109Project: Todo AppCombine state, lists and forms into a small app.
  9. 110Project: StopwatchUse state, effect and cleanup.
  10. 111Project: Live SearchFilter a list as the user types.
  11. 112Derived StateCompute values during render instead of storing duplicates.
  12. 113StrictModeStrictMode double runs some code in development to reveal bugs.
  13. 114Common MistakesAvoid mutating state, missing keys, stale closures and effect loops.
  14. 115AccessibilityUse semantic tags, labels and aria attributes.
  15. 116Testing ComponentsRender a component and assert on what the user sees.
  16. 117Project StructureGroup by feature, keep components small and name files after components.
  17. 118Starting a ProjectVite creates a fast React project.
  18. 119Environment VariablesVite exposes variables that start with VITE_ to the browser.
  19. 120Why Not Index KeysIndex keys break state when a list reorders.
  20. 121Event BubblingEvents bubble to parents.
  21. 122Actions and useNewer React lets forms call functions directly and use reads promises.