Skip to main content
InterviewHubPRO
Section Overview
Q78

Question 78 of 407

Part 2: React Router & Navigation (78 - 88)

19%
React Core & Hooks (407 Qs)•Part 2: React Router & Navigation (78 - 88)

What is React Router?

junior LevelCode ExampleRouting

React Router is a powerful routing library built on top of React that helps you add new screens and flows to your application incredibly quickly, all while keeping the URL in sync with what's being displayed on the page.

Practical Code Example

jsx
// React Router: Client-side routing library for Single Page Applications
import { BrowserRouter, Routes, Route, Link } from 'react-router-dom';

function App() {
  return (
    <BrowserRouter>
      <nav><Link to="/">Home</Link> | <Link to="/about">About</Link></nav>
      <Routes>
        <Route path="/" element={<Home />} />
        <Route path="/about" element={<About />} />
      </Routes>
    </BrowserRouter>
  );
}