how to use react link code example

Example 1: Link react router

<Link to="/about">About</Link>

Example 2: react link to another page

import { Link } from 'react-router-dom';

classAppextendsComponent {
    render() {
        return (
            <div class="container">
                <nav>
<Link to="/">Home</Link>
<Link to="/dashboard">Dashboard</Link>
                </nav>
                <Route
                    path="/"
                    component={HomeComponent}
                    exact 
                />
                <Route
                    path="/dashboard"
                    component={DashboardComponent} 
                />
            </div>
        );
    }
}

Example 3: link in react

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