Question 1
What is true about Error Boundaries in React?
Correct Answer:
Error Boundaries automatically fix errors in components.
Explanation:
Error boundaries focus on protecting the UI from render-time errors by catching exceptions that occur while a part of the component tree renders, in the lifecycle methods, or in constructors of child components. When such an error happens, the boundary renders a fallback UI instead of crashing the whole app, so users see something graceful while the rest of the interface remains usable. They do not catch errors in event handlers, so errors thrown inside click or submit handlers aren’t handled by the boundary—you’d handle those inside the event handler itself or with local try/catch. Error boundaries are implemented as class components that define componentDidCatch and, optionally, getDerivedStateFromError; they are not hooks-based. They do not fix errors automatically; they merely provide a safe fallback UI when an error occurs.
Question 2
Where must hooks be called?
Correct Answer:
At the top level of a function component or a custom hook.
Explanation:
Hooks must be called at the top level of a function component or a custom hook. This ensures the order of every hook call stays the same across renders, which React relies on to correctly attach state and effects to each hook. Calling a hook inside a conditional, loop, or nested function would change that order from render to render. That breaks React’s internal bookkeeping and can lead to errors or unpredictable behavior. By placing all hook calls at the top level, you guarantee a stable sequence, and you use the hook results later in render logic or effects as needed. Within a component, you should call the hooks unconditionally in the function body, and then use conditional logic to decide what to render or how to react based on the hook values. Similarly, a custom hook follows the same rule: its hook calls must be at the top level of the function, not inside conditionals. Other options miss this requirement because hooks aren’t tied to lifecycle methods or class components, and they aren’t meant to be invoked after rendering. The correct approach is to call them at the top level of a function component or a custom hook.
Question 3
When should you use useCallback?
Correct Answer:
To memoize stable function references to prevent unnecessary re-renders.
Explanation:
useCallback is about keeping function references stable across renders. In React, a new function instance is created on every render, and if you pass that function down to a child component that relies on referential equality (for example a child wrapped with React.memo), the child can re-render unnecessarily just because the function prop changed. Wrapping the function with useCallback returns the same function instance unless its dependencies change, which helps prevent those extra re-renders and keeps performance where it matters. This doesn’t memoize a computed value—useMemo does that. It also isn’t about managing state or performing side effects; those are handled by useState and useEffect, respectively. So the correct idea is that useCallback memoizes stable function references to prevent unnecessary re-renders.
Question 4
What is the difference between server-side rendering and client-side rendering in React?
Correct Answer:
CSR renders markup in the browser after JavaScript runs; SSR renders HTML on the server for the initial load, with hydration to reconcile server HTML with client code.
Explanation:
Rendering strategy in React is about where the initial HTML comes from. In client-side rendering, the browser runs the JavaScript bundle to build the UI, producing the markup in the DOM after the JS executes. In server-side rendering, the server generates the HTML for the initial page request and sends that HTML to the browser, so the user sees content right away without waiting for JavaScript to run. When the client loads the server-rendered page, React runs and hydrates that markup—reconciling the server HTML with the client-side code so event handlers and interactivity work correctly without replacing the entire DOM. Hydration is the key bridging step: it attaches the React components to the server-generated HTML, enabling interactivity while preserving the fast, content-first initial load that SSR provides. This explains why SSR often helps with perceived performance and SEO, while CSR can offer quicker interactivity after the bundle loads but may delay the initial visible content. The correct description matches this idea: the browser renders after JavaScript runs, while the server renders the initial HTML and the client hydrates it to become fully interactive. The other options either misstate what SSR or CSR do (for example, claiming CSS-only rendering, or tying SSR/CSR to features like Suspense or portals that aren’t their defining difference).
Question 5
A React component should use 'state' to store information that the component itself can change.
Correct Answer:
True
Explanation:
State is the place where a React component stores data it can change over time. When you update that data, React re-renders the component so the UI stays in sync with the current values. This is why the statement in the question matches how React components manage their own dynamic information: the component uses state to hold data it can alter, such as user input, toggles, counters, or form fields. Props, on the other hand, come from outside the component and are read-only inside it. They’re useful for configuring a component, but the component itself shouldn’t try to mutate them. If you need to reflect changes from outside, you’d typically lift state up or have the parent pass a new prop value, not mutate the prop directly. The idea that state should be mutated by external components is also not how React state works—the component owns its own state, and updates to it should go through the provided update mechanism (like setState or a setter from useState). Similarly, props are not meant to manage internal changes; they’re the inputs the component receives from its parent. In short, state is the right tool for internal, changeable data, which is why the statement is correct.
Question 1
Exam overview

About this Exam

Prepare with the ReactJS Practice Test practice quiz. This question bank includes 10 questions covering react, component, rendering, store, and information. Use it to review important concepts, identify knowledge gaps, and build confidence for the related exam, course, or assessment.

More details

Additional Information

ReactJS Practice Test

This practice set contains 10 questions from the matching question bank and focuses on react, component, rendering, store, and information. Work through each question carefully, review the provided solutions, and revisit topics that need more study before your next attempt.

This is an independent study resource intended for practice and review; it is not an official examination or an endorsement by any organization named in the title.

Quiz information

Frequently Asked Questions

The complete question count is available after full access is unlocked.
No fixed duration is currently configured for this quiz.
Question explanations are included where they are available in the quiz content, helping you review the reasoning after answering.
Yes. You can retake the practice test again as you continue studying during your available access period.
After your access is confirmed, you can continue into the complete practice exam from this quiz flow.
Unless explicitly stated otherwise, this page provides independent practice material for study and exam preparation and is not the official examination itself.