Attempted import error Switch is not exported from react-router-dom

0 votes

Code:

import React from 'react';
import './App.css';
import NavBar from './components/navbar.js';
import Footer from './components/footer.js';
import Home from './components/pages/homepage/home.js';
import { BrowserRouter as Router, Switch, Route, Link } from 'react-router-dom';

function App() {
  return (
    <Router>
      <div className="app-container">
        <NavBar />
        <Switch>
          <Route path="/home" component={Home} />
        </Switch>
        <Footer />
      </div>
    </Router>
  );
}

export default App;

I keep getting this error:

Attempted import error: 'Switch' is not exported from 'react-router-dom'.

I tried uninstalling and installing the react-router-dom package. But I am still getting that error, How can I fix this?

May 15, 2022 in Others by Kichu
• 19,050 points
4,791 views

No answer to this question. Be the first to respond.

Your answer

Your name to display (optional):
Privacy: Your email address will only be used for sending these notifications.

Related Questions In Others

0 votes
3 answers

error "VT-x is not available (VERR_VMX_NO_VMX)."

Either the VT-x is disabled in the BIOS ...READ MORE

answered Oct 27, 2020 in Others by Diksha
• 140 points

edited Oct 27, 2020 by Gitika 884 views
+1 vote
0 answers
0 votes
1 answer

HTTP Error 403.14 - Forbidden - The Web server is configured to not list the contents of this directory

Try keeping this into your web config ...READ MORE

answered Feb 11, 2022 in Others by Rahul
• 9,670 points
9,529 views
0 votes
1 answer

ERROR:'keytool' is not recognized as an internal or external command, operable program or batch file

Check if the directory and the keytool ...READ MORE

answered Feb 18, 2022 in Others by Rahul
• 9,670 points
7,029 views
0 votes
1 answer

AWS EC2: Instance from my own Windows AMI is not reachable

The existing administrator password (and other user ...READ MORE

answered Mar 9, 2022 in Others by gaurav
• 23,220 points
345 views
0 votes
1 answer

How can I remove a port from url for node app using nginx

If you run your node server on ...READ MORE

answered Apr 10, 2018 in DevOps on Cloud by ajs3033
• 7,300 points
3,396 views
0 votes
3 answers

ReactJS vs Angular Comparison: Which is better?

One picture, many facts How can you compare ...READ MORE

answered Aug 11, 2018 in Events & Trending Topics by slayer
• 29,350 points
894 views
+2 votes
4 answers
webinar REGISTER FOR FREE WEBINAR X
REGISTER NOW
webinar_success Thank you for registering Join Edureka Meetup community for 100+ Free Webinars each month JOIN MEETUP GROUP