React-Router-Dom
$ npm install --save react-router-dom
Enthusiastic Elephant
$ npm install --save react-router-dom
npm install react-router-dom
npm install react-router-dom
import { useLocation } from "react-router-dom";
function Locaions() {
let location = useLocation();
return (
<>
{location.pathname === "/Home" ?
"Hi i am at the homepage"
:
"d-none"
}
</>
);
}
npm i @types/react-router-dom
import * as React from "react";
import * as ReactDOM from "react-dom";
import { BrowserRouter } from "react-router-dom";
import "./index.css";
import App from "./App";
import * as serviceWorker from "./serviceWorker";
ReactDOM.render(
<BrowserRouter>
<App />
</BrowserRouter>,
document.getElementById("root")
);