Before you begin
Prerequisites
Hidden — select the eye to show
Block 04 · COMPONENT PATH
Ten imported modules covering JSX, components, state, effects, context, refs, and reusable hooks.
Before you begin
Hidden — select the eye to show
What you will master
Hidden — select the eye to show
Final proof of skill
Hidden — select the eye to show
Completion standard
Hidden — select the eye to show
Progress one module at a time
React is a JavaScript library by Meta for building user interfaces, using a component-based architecture — each piece of UI is an isolated, reusable function. Key ideas: component tree, Virtual DOM, declarative rendering, one-way data flow.
JSX is a syntax extension that lets you write HTML-like markup inside JavaScript. Babel compiles it to React.createElement() calls.
React apps are trees of components. Each component is a function that takes props (inputs) and returns JSX (output).
State is data that changes over time and lives inside a component. When state changes, React re-renders the component with fresh values.
Handling events:
Rendering lists:
A side effect is anything that reaches outside a component — fetching data, setting timers, updating the document title, or subscribing to events.
Context solves prop drilling — passing data through many components that don't need it.
useReducer — for complex state with multiple actions, cleaner than several useState calls:
Extract stateful logic into reusable hook functions. Must start with "use".
Choose local, lifted, reducer, context, URL, and server state deliberately instead of storing everything in one component.
Model loading, success, empty, stale, and error states while preventing races and unnecessary requests.
Test behavior from the user perspective with accessible queries, interactions, async assertions, and controlled dependencies.
Measure before optimizing, reduce avoidable renders, lazy-load heavy work, and build keyboard- and screen-reader-friendly components.
Combine component architecture, state, data, forms, accessibility, testing, performance, and deployment readiness.