Routing in React Quiz

Routing in React Quiz

Last Updated :
Discuss
Comments

Question 1

What is the purpose of routing in a React application?

  • To manage component state

  • To navigate between views without reloading the page

  • To fetch data from a server

  • To compile JavaScript code

Question 2

What is react-router-dom in React?

  • A library to style components

  • A built-in browser router

  • A routing library for DOM-based React apps

  • A tool to manage Redux state

Question 3

Which component is commonly used to wrap a React app for enabling routing?

  • <Routes>

  • <Switch>

  • <Router>

  • <BrouserRouter>

Question 4

What is the use of the <Route> component in react-router-dom?

  • To render a component based on the current URL path

  • To conditionally render elements

  • To define styles for components

  • To fetch data from an API

Question 5

Which of the following is NOT a router type in react-router-dom?

  • BrowserRouter

  • HashRouter

  • FileRouter

  • MemoryRouter

Question 6

What is the main purpose of the <Link> component in react-router-dom?

  • To create HTML anchors

  • To apply inline styles

  • To fetch data from URLs

  • To perform navigation without full page reloads

Question 7

What does the useNavigate hook do in React Router?

  • Programmatically redirects to another route

  • Renders routes conditionally

  • Tracks browser history

  • Parses query parameters

Question 8

What is the role of useParams hook in React Router?

  • To set route path

  • To access dynamic route values from the URL

  • To validate form input

  • To manage component state

Question 9

What is a nested route in React Router?

  • A route outside the BrowserRouter

  • A route that calls an external API

  • A route that always redirects

  • A route rendered inside another route’s component

There are 9 questions to complete.

Take a part in the ongoing discussion