“React Router Params URL” Kod odpowiedzi

React Router Params URL

import { Route, useParams } from "react-router-dom";

// Route with URL param of id
<Route path="/:id" children={<Child />} />

// We can use the `useParams` hook here to access
// the dynamic pieces of the URL.
let { id } = useParams();
hm

React Router Link z Params

<Link to={{
  pathname: '/tylermcginnis',
  state: {
    fromNotifications: true
  }
}}>Tyler McGinnis</Link>
Tame Tarantula

React Uzyskaj paramenty trasy

const Child = ({ match }) => (
  <div>
    <h3>ID: {match.params.id}</h3>
  </div>
)
Itchy Iguana

Odpowiedzi podobne do “React Router Params URL”

Pytania podobne do “React Router Params URL”

Więcej pokrewnych odpowiedzi na “React Router Params URL” w JavaScript

Przeglądaj popularne odpowiedzi na kod według języka

Przeglądaj inne języki kodu