“React-Router-Dom” Código de respuesta

React-Router-Dom

$ npm install --save react-router-dom
Enthusiastic Elephant

React-Router-Dom

npm install react-router-dom
Roseat Flamingo

React-Router-Dom

npm install react-router-dom
Upset Unicorn

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"
    }
    </>
  );
}
Didi Abel

React-Router-Dom

npm i @types/react-router-dom
Enchanting Elephant

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")
);
Aggressive Alpaca

Explore las respuestas de código populares por idioma

Explorar otros lenguajes de código