🌍 Frontend Web Development · subject

Frontend Web Development React & Component Frameworks Syllabus

The React & Component Frameworks syllabus for Frontend Web Development in full: 7 chapters and 28 topics, every one listed below, plus 69 React & Component Frameworks flashcards with answers.

7Chapters
28Topics
69Flashcards

React & Component Frameworks syllabus: all 7 chapters

Expand any chapter to see its topics and sub-topics.

  1. React Fundamentals

    4 topics
    • JSX & Rendering
    • Components & Composition
    • Props & PropTypes
    • Conditional & List Rendering
  2. State & Hooks

    5 topics
    • useState & State Updates
    • useEffect & Lifecycle
    • useRef & useMemo / useCallback
    • useContext & useReducer
    • Custom Hooks
  3. Events, Forms & Effects

    4 topics
    • Handling Events in React
    • Controlled & Uncontrolled Inputs
    • Form Libraries (React Hook Form)
    • Data Fetching Patterns
  4. Routing & Navigation

    3 topics
    • Client-Side Routing (React Router)
    • Nested Routes & Params
    • Programmatic Navigation & Guards
  5. State Management

    4 topics
    • Lifting State & Prop Drilling
    • Context API Patterns
    • Redux Toolkit & Zustand
    • Server State (TanStack Query)
  6. Meta-Frameworks & SSR

    4 topics
    • Next.js App Router
    • Rendering Strategies (SSR, SSG, ISR)
    • Data Fetching & Server Actions
    • Alternative Frameworks (Vue, Svelte, Astro)
  7. Performance & Patterns

    4 topics
    • Memoization & Re-render Optimization
    • Code Splitting & Lazy Loading
    • Component Design Patterns
    • Error Boundaries & Suspense

Frontend Web Development React & Component Frameworks flashcards — 69 questions with answers

  1. What is JSX and how is it processed before running in the browser?

    JSX is a syntax extension for JavaScript that lets you write HTML-like markup inside JS. It is not valid JS itself; a compiler (Babel/SWC) transpiles it into React.createElement(...) calls (or _jsx() with the automatic runtime), producing plain JavaScript objects (React elements).

  2. In JSX, why must you use className and htmlFor instead of class and for?

    Because JSX compiles to JavaScript objects and class and for are reserved words in JS. React uses the DOM property names className and htmlFor instead.

  3. How do you embed a JavaScript expression inside JSX, and what is NOT allowed there?

    Wrap the expression in curly braces, e.g. {count + 1}. Only expressions are allowed (values, function calls, ternaries), not statements like if, for, or variable declarations.

  4. What is a React element versus a React component?

    A React element is a lightweight, immutable plain-object description of what to render (type, props, children). A component is a function (or class) that returns elements; React calls the component to produce elements.

  5. Why must adjacent JSX elements be wrapped, and what lightweight wrapper avoids extra DOM nodes?

    A component/expression can return only one root node. Wrap siblings in a single parent, or use a Fragment (<>...</> or <React.Fragment>) to group them without adding an extra DOM element.

  6. When React renders {false}, {null}, {undefined}, or {true} in JSX, what appears on screen?

    Nothing. React ignores false, null, undefined, and true and renders no output for them. Note that 0 IS rendered, which causes bugs like {count && <X/>} showing 0.

  7. What is the minimal definition of a valid React function component?

    A JavaScript function whose name starts with a capital letter and that returns JSX (a React element) or null. Example: function Hello() { return <h1>Hi</h1>; }

  8. What does 'composition' mean in React, and how does it replace inheritance?

    Composition means building complex UIs by nesting and combining smaller components, passing components/elements via props (including children). React recommends composition over class inheritance for reusing code between components.

  9. What is the special children prop and how is it passed?

    props.children holds whatever JSX is nested between a component's opening and closing tags. It lets a component render arbitrary content passed by its parent, enabling wrapper/layout components.

  10. What are props, and what key rule governs them (immutability)?

    Props are read-only inputs passed from a parent to a child component. A component must never modify its own props; props are immutable from the receiver's perspective (one-way data flow, parent to child).

  11. How do you give a prop a default value in a function component?

    Use default parameter values during destructuring, e.g. function Btn({ size = 'md' }) { ... }. (The legacy Component.defaultProps still works for class components but is deprecated for function components.)

  12. What is the purpose of PropTypes and how do you require a string prop named title?

    PropTypes provide runtime type-checking of props in development, warning in the console on mismatches. Example: Component.propTypes = { title: PropTypes.string.isRequired }.

  13. List three common PropTypes validators and their meaning.

    PropTypes.number / .string / .bool (primitive types); PropTypes.func (a function); PropTypes.node (anything renderable) or PropTypes.arrayOf(PropTypes.number) (typed array). Append .isRequired to make any required.

  14. Why is prop-drilling considered a problem, and name one alternative?

    Prop-drilling passes data through many intermediate components that don't use it, only to reach a deep child, making code verbose and fragile. Alternatives: React Context, component composition (passing elements as children), or state libraries.

  15. How do you conditionally render an element using the logical AND (&&) operator, and its pitfall?

    {condition && <Element/>} renders Element only when condition is truthy. Pitfall: if condition is 0 (a falsy number), React renders 0 on screen. Convert to boolean, e.g. {count > 0 && ...}.

  16. How do you render one of two elements based on a condition inline?

    Use a ternary: {isLoggedIn ? <Logout/> : <Login/>}. Ternaries are expressions, so they work directly inside JSX braces.

  17. How do you render a list of items from an array in JSX?

    Use array.map() to return one element per item, e.g. {items.map(i => <li key={i.id}>{i.name}</li>)}. Each returned element needs a unique key prop.

  18. What is the purpose of the key prop when rendering lists, and why not use the array index?

    Keys give elements a stable identity so React can match items between renders and update efficiently. Using the array index breaks when items are inserted, removed, or reordered, causing wrong state/DOM reuse; use a stable unique id instead.

  19. What must be true about key values among sibling list elements?

    Keys must be unique among siblings (not globally) and stable across renders. They should come from the data (e.g. an id), not be randomly generated on each render.

  20. What does the useState hook return, and how is it destructured?

    It returns an array of exactly two elements: the current state value and a setter function. Convention: const [value, setValue] = useState(initial).

Show the other 49 React & Component Frameworks flashcards
  1. Why should you use the functional updater form setCount(c => c + 1) instead of setCount(count + 1)?

    The functional form receives the latest pending state, so multiple updates in the same event batch compose correctly. setCount(count + 1) uses the value captured at render, causing lost updates when called several times in one event.

  2. Is React state update synchronous or asynchronous, and what is batching?

    State updates are asynchronous and batched: React groups multiple setState calls within an event handler into a single re-render for performance. The state variable does not change until the next render.

  3. When updating object or array state, why must you create a new reference?

    React uses Object.is reference comparison to detect changes. Mutating the existing object/array keeps the same reference, so React may skip re-rendering. You must produce a new object/array, e.g. setUser({ ...user, name }) or setList([...list, item]).

  4. What does passing a function to useState (lazy initialization) do?

    useState(() => expensiveInit()) runs the initializer function only on the first render to compute the initial state, avoiding re-running the expensive computation on every render.

  5. What is the purpose of useEffect?

    useEffect lets you run side effects (data fetching, subscriptions, manual DOM changes, timers) after the component renders and commits to the DOM, synchronizing the component with external systems.

  6. Explain how the useEffect dependency array controls when the effect runs.

    No array: runs after every render. Empty array []: runs once after mount. Array [a, b]: runs after mount and whenever any listed dependency changes (compared with Object.is).

  7. What is the effect cleanup function and when does it run?

    A function returned from the effect callback. React runs it before the effect re-runs (on dependency change) and when the component unmounts, used to clear timers, unsubscribe, or abort requests to prevent leaks.

  8. In terms of the class lifecycle, what does useEffect(fn, []) correspond to, and useEffect(fn) with a cleanup?

    useEffect(fn, []) ≈ componentDidMount (+ cleanup ≈ componentWillUnmount). useEffect(fn) running every render with a cleanup ≈ componentDidMount + componentDidUpdate + componentWillUnmount combined.

  9. Why can omitting dependencies from useEffect cause stale closures?

    The effect closes over variables from the render in which it was created. If a used value is not in the dependency array, the effect keeps referencing the old (stale) value from that render instead of the current one.

  10. What does useRef return and what are its two main uses?

    useRef(initial) returns a mutable object { current: initial } that persists across renders without causing re-renders when changed. Uses: (1) accessing a DOM node via ref={myRef}; (2) storing mutable instance-like values (timers, previous values).

  11. How does useRef differ from useState for storing a value?

    Changing ref.current does NOT trigger a re-render and the change is visible immediately (mutable), whereas calling a state setter DOES trigger a re-render and the new value appears only on the next render.

  12. What does useMemo do and when should you use it?

    useMemo(() => compute(a, b), [a, b]) memoizes and returns a cached computed value, recomputing only when a dependency changes. Use it to avoid expensive recalculations or to keep a stable reference for object/array props.

  13. What does useCallback do and how does it relate to useMemo?

    useCallback(fn, deps) memoizes the function itself, returning the same function reference until a dependency changes. It is equivalent to useMemo(() => fn, deps). Useful to keep stable callback references for memoized children.

  14. Why does a stable callback from useCallback matter for a child wrapped in React.memo?

    React.memo skips re-rendering when props are shallowly equal. A new inline function every render is a new reference, breaking memoization. useCallback preserves the reference so the memoized child can actually skip re-rendering.

  15. What does useContext do and what argument does it take?

    useContext(MyContext) reads and subscribes to the current value of a Context object provided by the nearest matching <MyContext.Provider> above it in the tree, avoiding prop-drilling.

  16. When a Context Provider's value changes, which components re-render?

    All components that consume that context via useContext re-render when the provider's value changes (by reference), regardless of whether they use the changed part. This is why splitting contexts or memoizing the value matters.

  17. What does useReducer return, and what are the arguments to its dispatched reducer?

    useReducer(reducer, initialState) returns [state, dispatch]. Calling dispatch(action) invokes reducer(state, action), which returns the new state. Good for complex or interdependent state logic.

  18. When should you prefer useReducer over useState?

    When state is complex (multiple sub-values), when the next state depends on previous state through several update types, or when you want to centralize update logic in one testable reducer and pass dispatch down instead of many callbacks.

  19. What are the two rules of hooks?

    (1) Only call hooks at the top level, never inside loops, conditions, or nested functions. (2) Only call hooks from React function components or from custom hooks, not regular JS functions.

  20. Why must hooks be called in the same order on every render?

    React tracks hook state by call order (an internal index), not by name. Conditionally skipping or reordering hooks misaligns stored state with the wrong hook, corrupting state and causing errors.

  21. What defines a custom hook and what naming convention is required?

    A custom hook is a JavaScript function whose name starts with 'use' and that calls one or more built-in hooks to encapsulate and reuse stateful logic between components. The 'use' prefix lets React enforce the rules of hooks.

  22. Do two components using the same custom hook share state?

    No. Each call to a custom hook creates its own isolated state and effects. Custom hooks share logic, not state; the state is instantiated fresh per component that uses the hook.

  23. How do you attach an event handler in React, and how does the syntax differ from HTML?

    Pass a function to a camelCase event prop, e.g. <button onClick={handleClick}>. Unlike HTML, the name is camelCase (onClick not onclick) and you pass a function reference, not a string of code.

  24. What is a SyntheticEvent in React?

    A cross-browser wrapper around the native DOM event that React passes to handlers, providing a consistent API (e.g. e.preventDefault(), e.target) across browsers.

  25. How do you pass an argument to an event handler without calling it immediately?

    Wrap it in an arrow function: onClick={() => handleDelete(id)}. Writing onClick={handleDelete(id)} would call it during render instead of on click.

  26. What is a controlled input in React?

    A form input whose value is driven by React state via the value (or checked) prop and updated through an onChange handler. React state is the single source of truth for the input's value.

  27. What is an uncontrolled input, and how do you read its value?

    An input that keeps its own value in the DOM rather than in React state. You read its value when needed via a ref (e.g. inputRef.current.value), often using defaultValue for the initial value.

  28. Contrast controlled vs uncontrolled inputs on the source of truth and typical access.

    Controlled: React state is the source of truth, value set by state, updated via onChange (enables instant validation/formatting). Uncontrolled: the DOM is the source of truth, initialized with defaultValue, read on demand via a ref.

  29. What core problem does React Hook Form solve, and how does it minimize re-renders?

    It manages form state, validation, and submission with minimal boilerplate. It primarily uses uncontrolled inputs via register() and refs, so keystrokes don't trigger component re-renders, improving performance versus fully controlled forms.

  30. In React Hook Form, what do register, handleSubmit, and formState.errors do?

    register('name') wires an input to the form (returns props incl. ref/onChange). handleSubmit(onValid) validates then calls your submit handler with the values. formState.errors holds validation error messages per field.

  31. What is a common pattern for fetching data on mount with useEffect, including avoiding state updates after unmount?

    Call the async fetch inside useEffect(() => {...}, []) with an AbortController or an 'ignore/cancelled' flag; in cleanup, abort or set the flag so the response handler doesn't setState after the component has unmounted.

  32. Why can't the useEffect callback itself be declared async, and what is the workaround?

    An async function returns a Promise, but useEffect expects its return value to be a cleanup function (or nothing). Workaround: define an async function inside the effect and call it, e.g. useEffect(() => { (async () => { ... })(); }, []).

  33. In React Router (v6+), what components define the router and a route mapping a path to an element?

    Wrap the app in <BrowserRouter>. Inside, use <Routes> containing <Route path="/users" element={<Users/>} /> entries. The first matching Route renders its element.

  34. What component does React Router provide for client-side navigation instead of an <a> tag, and why?

    <Link to="/path"> (or <NavLink> for active styling). It updates the URL and renders the matched route without a full page reload, preserving SPA state, whereas a plain <a> triggers a full document reload.

  35. How do you define a nested route in React Router, and how does the parent render its child?

    Nest <Route> elements inside a parent <Route>. The parent component renders <Outlet/> where the matched child route's element should appear. Index routes (<Route index .../>) render at the parent's exact path.

  36. How do you declare a URL parameter in a route and read it in the component?

    Declare it with a colon: <Route path="/users/:id" .../>. Read it with the useParams hook: const { id } = useParams();

  37. What is the difference between route params and query string parameters, and which hook reads the query string?

    Route params are part of the path pattern (/users/:id) and identify a resource. Query params (?sort=asc) are optional key-value pairs after '?'. Read the query string with useSearchParams(), which returns [searchParams, setSearchParams].

  38. How do you navigate programmatically in React Router v6?

    Call the useNavigate hook to get a navigate function, then navigate('/path') to go there, navigate('/path', { replace: true }) to replace history, or navigate(-1) to go back one entry.

  39. How do you implement a simple route guard (protected route) in React Router v6?

    Create a wrapper that checks auth; if not authenticated, return <Navigate to="/login" replace />, otherwise render <Outlet/> (or children). Wrap protected routes in this guard component.

  40. What does the <Navigate> component do compared to the useNavigate hook?

    <Navigate to="..."/> declaratively redirects when it renders (useful in JSX/guards). useNavigate returns an imperative function to call inside handlers/effects. Both change the current location.

  41. What is 'lifting state up' and when do you do it?

    Moving shared state to the closest common ancestor of the components that need it, then passing it down via props (and passing setters/callbacks down). You do it when two or more sibling components must stay in sync on the same data.

  42. Describe the standard Context API pattern for sharing state across a tree.

    Create a context with createContext(default); wrap the tree in <Context.Provider value={sharedValue}>; consume it in descendants with useContext(Context). Often the value combines state and updater functions, sometimes exposed via a custom hook like useAuth().

  43. Why is it a common pattern to memoize the value passed to a Context Provider?

    Passing an inline object/array (value={{ user, setUser }}) creates a new reference every render, forcing all consumers to re-render. Wrapping it in useMemo (with proper deps) gives a stable reference so consumers re-render only when the data actually changes.

  44. What is a common way to combine useReducer with Context to build a lightweight global store?

    Put useReducer's state and dispatch into a Context Provider value; components read state via useContext and trigger updates by calling dispatch(action). This centralizes complex state and avoids prop-drilling without an external library.

  45. When passing data upward from child to parent, what mechanism does React use?

    React data flow is one-way (parent to child), so a child cannot push data up directly. The parent passes a callback prop down; the child calls that callback (e.g. onChange(value)) to send data back up to the parent.

  46. What is the difference between defaultValue and value on an input in React?

    value makes the input controlled (React state owns it; needs onChange to be editable). defaultValue only sets the initial value for an uncontrolled input, after which the DOM manages the value.

  47. Why does React.memo help, and what kind of comparison does it perform?

    React.memo wraps a component so it skips re-rendering when its props haven't changed, performing a shallow comparison of props. It helps avoid unnecessary renders of expensive children whose props are stable.

  48. What is the correct way to update one field of an object stored in state?

    Spread the existing object and override the field, then set a new object: setForm(prev => ({ ...prev, email: newEmail })). This preserves other fields while creating a new reference so React re-renders.

  49. What is the correct immutable way to add and remove items from an array in state?

    Add: setList(prev => [...prev, item]). Remove: setList(prev => prev.filter(x => x.id !== id)). Avoid mutating methods like push/splice on the state array; always produce a new array.

Frontend Web Development React & Component Frameworks FAQ

What is in the Frontend Web Development React & Component Frameworks syllabus?

Frontend Web Development React & Component Frameworks is split into 7 chapters: React Fundamentals, State & Hooks, Events, Forms & Effects, Routing & Navigation, State Management, Meta-Frameworks & SSR and Performance & Patterns. Together they contain 28 topics.

How many chapters are in Frontend Web Development React & Component Frameworks?

7 chapters, containing 28 topics. The largest chapter is State & Hooks, with 5 topics.

Are there flashcards for Frontend Web Development React & Component Frameworks?

Yes — a 69-card React & Component Frameworks deck, printed in full in the flashcards section of this page and available in the Examius app with spaced repetition. The free plan covers one exam of your choice, including its flashcards; Examius Pro, a one-time purchase, unlocks every other exam and deck.