Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

519
Views
how does this error means in react-router-dom?

when I import switch from react-router-dom error screen shot when I import switch from react-router enter image description here

I copied code from https://v5.reactrouter.com/web/guides/quick-start

over 4 years ago · Santiago Trujillo
3 answers
Answer question

0

Switch is exported from "react-router", not from "react-router-dom"

Convert this:

import { Switch } from "react-router-dom";

to:

import { Switch } from "react-router";
over 4 years ago · Santiago Trujillo Report

0

Hello because Switch is exported from react-router

import { Switch } from "react-router";
over 4 years ago · Santiago Trujillo Report

0

I have faced similiar problem with importing Switch from react-router-dom. In my case, I was using the latest (v6, i think) version of react-router-dom where the "Switch" is replaced by "Routes".

So either you check your react-router-dom's version and replace Switch to Routes and change the Route declaraton from <Route path="/" component={Dashboard} /> to <Route path="/" element={Dashboard} /> if it's v6, or you want to downgrade your react-router-dom version and keep using Switch.

Your call.

over 4 years ago · Santiago Trujillo Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!