I'm new to React.js, and my first project is my portfolio website. So I have the index page render all the components, but I want to render the Resume component in a new window separately. Here's the code :
import {
Navbar,
Home,
Projects,
Aboutme,
Contact,
Footer,
Resume,
} from "./imports";
import { BrowserRouter as Router, Route, Switch } from "react-router-dom";
function App() {
return (
<Router>
<div id="app">
<Navbar />
<Home />
<Projects />
<Aboutme />
<Contact />
<Footer />
<Switch>
<Route exact path="/resume">
<Resume />
</Route>
</Switch>
</div>
</Router>
);
}
export default App;
Thank you in advance.
CodePudding user response:
I'm also new to react.js but I think you need something like this:
<Router>
<div id="app">
<Switch>
<Route exact path="/">
<Navbar />
<Home />
<Projects />
<Aboutme />
<Contact />
<Footer />
</Route>
<Route exact path="/resume">
<Resume />
</Route>
</Switch>
</div>
</Router>