QuizzesReact Router — Routes, Links and Layouts — Concept Check
intermediate
react

React Router — Routes, Links and Layouts — Concept Check

Questions on React Router — Routes, Links and Layouts. Routes map URLs to components, Link navigates without a reload, and nested routes let a layout stay mounted while only the inner part changes.

8 minutes 8 questions Pass at 70%
Time Limit
8 minutes - timer starts when you begin
Change Answers Freely
Revisit and change any answer before submitting
Full Review After Submit
Correct answers and explanations shown for every question
Auto-submit on timeout
Quiz submits automatically when time runs out

Questions in this quiz

8 questions on React Router — Routes, Links and Layouts — Concept Check. Work through them here, then start the quiz to answer them and see your score.

  1. 1.You have a React app with a `RootLayout` containing a header and footer. You navigate from `/home` to `/account/profile`. What happens to the `RootLayout`?

    • AThe `RootLayout` unmounts and remounts with new content.
    • BThe entire page reloads, including `RootLayout`.
    • CThe `RootLayout` partially re-renders, losing state.
    • DThe `RootLayout` stays mounted, only the inner content changes.
  2. 2.In a React Router setup, you use `<a href="/problems">Problems</a>` instead of `<Link to="/problems">Problems</Link>`. What is the consequence?

    • AThe navigation is faster and more efficient.
    • BThe page reloads, losing all state.
    • CThe app crashes due to incorrect syntax.
    • DThe URL changes without reloading the page.
  3. 3.Your route configuration includes an `errorElement` for a route. What is its purpose?

    • ATo log errors to an external service.
    • BTo prevent any errors from occurring.
    • CTo handle errors globally across all routes.
    • DTo catch and display errors specific to that route.
  4. 4.You have a nested route under `/account` with a `Profile` component. What URL path matches this route if `index: true` is set?

    • A`/profile`
    • B`/account/profile`
    • C`/account/index`
    • D`/account`
  5. 5.A developer uses `useNavigate()` to redirect after a form submission but forgets `{ replace: true }`. What might happen?

    • AThe user can navigate back to the form page.
    • BThe app throws an error due to missing options.
    • CThe redirect fails to occur.
    • DThe user is stuck on the new page.
  6. 6.What happens when a `loader` function throws an error in React Router?

    • AThe error is logged but not displayed.
    • BThe app crashes, showing a blank screen.
    • CThe `errorElement` for that route is rendered.
    • DThe error is ignored, and the app continues.
  7. 7.In a React Router setup, what is the effect of using `navigate(-1)`?

    • AIt reloads the current page without navigation.
    • BIt navigates back to the previous page in history.
    • CIt navigates forward to the next page in history.
    • DIt navigates to the root URL of the app.
  8. 8.A developer uses `<NavLink>` for navigation. What additional feature does `<NavLink>` provide over `<Link>`?

    • AIt provides better performance.
    • BIt automatically prevents page reloads.
    • CIt handles form submissions.
    • DIt can apply a class when the link is active.