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?

2 days ago in Others by Kichu
• 15,450 points
20 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 426 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 in Others by Rahul
• 8,980 points
1,100 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 in Others by Rahul
• 8,980 points
889 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 in Others by Edureka
• 8,820 points
33 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,280 points
2,611 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,310 points
400 views
+2 votes
4 answers
webinar REGISTER FOR FREE WEBINAR X
Send OTP
REGISTER NOW
webinar_success Thank you for registering Join Edureka Meetup community for 100+ Free Webinars each month JOIN MEETUP GROUP