
React Router
BrowserRouter, Routes, Route, Link, useNavigate, useParams, nested routes, protected routes
1What is BrowserRouter in React Router?
What is BrowserRouter in React Router?
Answer
BrowserRouter uses the browser's History API to create clean URLs without hash. Unlike HashRouter which adds a # in the URL, BrowserRouter provides a better user experience and SEO. However, it requires server configuration to properly handle routes in production.
2Which component should be used to define a route in React Router?
Which component should be used to define a route in React Router?
Answer
The Route component defines a match between a URL path and a component to display. It must be placed inside a Routes component to work correctly. Each Route specifies a path and an element to render when the URL matches.
3What is the purpose of the Link component in React Router?
What is the purpose of the Link component in React Router?
Answer
Link creates navigation links without reloading the page. Unlike the native HTML <a> tag, Link intercepts clicks and uses the History API to change the URL. This preserves application state and provides faster, smoother navigation.
What is the role of the Routes component?
How to retrieve a URL parameter like :id in /user/:id?
+17 interview questions
Other React / Next.js interview topics
JavaScript Essentials
React Fundamentals
React Hooks
Component Lifecycle
State Management with Context
Forms & Controlled Components
Data Fetching & API
React Query (TanStack Query)
Styling & CSS-in-JS
Next.js Fundamentals
TypeScript with React
Next.js Data Fetching
Next.js Server Actions
Next.js Routing & Navigation
Next.js API Routes
Next.js Metadata & SEO
Next.js Middleware & Auth
React Testing
Zustand State Management
React Performance Optimization
Error Boundaries & Error Handling
Advanced React Patterns
Next.js Advanced Features
Next.js Deployment & Production
Architecture & Design Patterns
React Server Components
Next.js Internationalization
React Security & Best Practices
Master React / Next.js for your next interview
Access all questions, flashcards, technical tests, code review exercises and interview simulators.
Start for free