useParams returns an object of key/value pairs of URL parameters.
The useRouteMatch hook attempts to match the current URL
current URL일 경우 다음과 같은 object를 반환하고.
current URL이 아닐 경우 null값을 반환한다.
The useLocation hook returns the location object that represents the current URL.
BrowserRouter is the recommended interface for running React Router in a web browser.
import * as ReactDOM from "react-dom";
import { BrowserRouter } from "react-router-dom";
ReactDOM.render(
<BrowserRouter>
{/* The rest of your app goes here */}
</BrowserRouter>,
root
);
https://reactrouter.com/docs/en/v6/routers/browser-router#browserrouter
A Link is an element that lets the user navigate to another page by clicking or tapping on it.
A string representation of the Link location, created by concatenating the location’s pathname, search, and hash properties.
<Link to="/courses?sort=name" />
An object that can have any of the following properties:
<Link
to={{
pathname: "/courses",
search: "?sort=name",
hash: "#the-hash",
state: { fromDashboard: true }
}}
/>
How is this different than just using a bunch of Routes?
Switch is unique in that it renders a route exclusively. In contrast, every Route that matches the location renders inclusively. Consider these routes: