<Link>

Like the HTML <a> tag, <Link> specifies a hyperlink.

Attributes:

to: String

the destination URL string.

to: Location Object

the destination URL object with the following properties.

pathname: the path to link to.

search: the query parameters.

hash: the hash. Eg. #productX

state: the state object to persist to the location.

to: Function

a function to which the current location is passed as an argument, and which should return the destination location as a string or as an object.

replace: bool

when true, clicking the link will replace the current entry in the history stack instead of adding a new one.

component: React.Component

your own navigation component.

O thers

You can also pass props you'd like to be on the compiled <a> such as a title, id, className, etc.


RESETRUNFULL
<Link to="/courses?sort=name">…

<Link to={{ pathname: "/courses",
                   search: "?sort=name",
                   hash: "#the-hash",
                   state: { fromDashboard: true } }}>…

<Link to={location => ({ ...location, pathname: "/courses" })} >…

<Link to={location => `${location.pathname}?sort=name`} >…

<Link to="/courses" replace >…

const FancyLink = React.forwardRef((props, ref) => (
  <a ref={ref} {...props}>💅 {props.children}</a>))<Link to="/" component={FancyLink} >…