ZakariyeAden / Shopping-Cart

0 stars 0 forks source link

Switch/BrowseRouter Issue #1

Open ZakariyeAden opened 2 years ago

ZakariyeAden commented 2 years ago

Having issues importing browseRouter in the index.js. And Switch in the app.js

rcamach7 commented 2 years ago

Found your issue. In react-router-dom v6+, "Switch" is replaced by routes "Routes". You need to update the imports. Different names but they do the same thing.

From: import { Switch, Route } from "react-router-dom"; To: import { Routes ,Route } from 'react-router-dom';

Also in your index.js file you need to wrap your BrowserRouter import with curly braces, and move the closing slash in your component from to