PGoCareerGoCareer prep tools
Home
LoginSign up
  • Java
  • Python
  • AI
  • React
  • Angular
  • PHP
  • Node.js
  • SQL
  • DSA
  • HTML
  • CSS
  • JS
  • Spring
  • ML
  • MongoDB

React · Theory

BrowserRouter in React

← All stacks

Theory

57/94

BrowserRouter in React

BrowserRouter uses the real path: /about. HashRouter uses /#/about. Real paths look better and help SEO a bit, but the server must return index.html for unknown paths — otherwise refresh on /about is a 404. That’s the deploy trap.

Vite/Netlify/nginx SPA fallback is the fix. Mention it. Don’t only recite ‘BrowserRouter is better’.

BrowserRouter in React — output — real URL vs hash vs deploy trap. Refresh on /about must not 404.

Diagram
URL /about
      │ BrowserRouter
      ▼
  <Route> → About
      │ Link
      ▼
  no full reload
Exam tip

Real URL + refresh 404 trap.

Example

// BrowserRouter
console.log("BrowserRouter uses /about in the address bar");
console.log("HashRouter would use /#/about");
console.log("Deploy: serve index.html for unknown paths");

BrowserRouter in React — output: real URL vs hash vs deploy trap. Refresh on /about must not 404.

Short notes

  • DefHTML5 history URLs.
  • Needserver fallback to index.html.
  • Alt : HashRouter if you can’t configure the server.

Questions

1

Explain BrowserRouter as if you are teaching a junior — definition, then one tiny UI.

2

What does the example show on screen (or print), and what does that prove?

3

What mistake do freshers make with BrowserRouter?

Previous← PropTypes in ReactNextReact vs Svelte →
P

GoCareerGo

Utilities · Preparation Hub · Resume · CV · Tools — one workspace.

Workspace

DashboardProfilePreparation HubResume builderCV builderCareer planning

PDF Tools

Merge PDFSplit PDFCompress PDFImage to PDFAll toolsJobs

Image & QR

Compress ImageResize ImageQR ScannerQR GeneratorBlogIT interview prep

Company

FAQFeedbackContactPrivacyTermsSitemap

© 2026 GoCareerGo. Keep moving forward.