import "./App.css"; import { BrowserRouter as Router, Switch, Route } from "react-router-dom"; import ProductListing from "./Pages/Product.js"; import ProductListings from "./Pages/ProductList.js"; function App() { return ( <Router> <> <div className="container"> <Switch> <Route path="/product/:id"> <ProductListing /> </Route> <Route path="/"> <ProductListings /> </Route> </Switch> </div> </> </Router> ); } export default App;
Preview:
downloadDownload PNG
downloadDownload JPEG
downloadDownload SVG
Tip: You can change the style, width & colours of the snippet with the inspect tool before clicking Download!
Click to optimize width for Twitter