I have my app on localhost:3000, and having the code below in App.js (create-react-app) , According to me on the homepage of the App only 'Burger' component should render and 'Order' component should open in a different page on click of a button that i placed somewhere in the 'Burger' Component, but what's happening is that contents of the 'Order' component are getting rendered on the homepage as well, I want only 'Burger' Component contents to be on the homepage.
import React from "react";
import "./App.css";
import Burger from "./components/Burger/Burger";
import {
Redirect,
Switch,
BrowserRouter as Router,
Route,
} from "react-router-dom";
import Order from "./components/Order/Order";
function App() {
return (
<div className="App">
<Switch>
<Route path="/" component={Burger} exact />
<Route path="/order" component={Order} />
</Switch>
</div>
);
}
export default App;