Forum for Geeks

Export 'Switch' was...
 
Notifications
Clear all

Export 'Switch' was not found in 'react-dom'

3 Posts
2 Users
2 Likes
108 Views
jakli
Posts: 3
Topic starter
(@jakli)
Active Member
Joined: 2 months ago

The problem is noticed while routing in react. So, how to solve the problem? 

Topic Tags
2 Replies
Saheb Dhara
Posts: 2
Admin
(@saheb)
New Member
Joined: 2 years ago
import {
  BrowserRouter,
  Routes,
  Route
} from "react-router-dom";



function App() {
  return (


  <BrowserRouter>
    <Routes>
      <Route path="/" element={<Home />} />
      <Route path="/profile/:username" element={<Profile />} />
      <Route path="/login" element={<Login />} />
      <Route path="/resister" element={<Resister />} />
     


     
    </Routes>
  </BrowserRouter>

Please make sure that you are using the latest version of React. And if you are using another code for adding routes then you have to use this code instead of yours.  

Reply
1 Reply
jakli
(@jakli)
Joined: 2 months ago

Active Member
Posts: 3

@saheb Thanks, it is working

Reply
Share: