react-router
React Router enables "single page routing".
Since ReactLynx only have React v17 API now, you should install react-router
v6.
Routes are configured by rendering <Routes>
and <Route>
that couple URL segments to UI elements.
See React Router - Routing for details.
There are no <Link>
or <NavLink>
components now in ReactLynx.
You may use useNavigate
to navigate between routes.
Route params are the parsed values from a dynamic segment.
In this case, :city
is the dynamic segment. The parsed value for that city will be available from useParams
See React Router - useParams for more details.
React Router creates a custom location object with some useful information on it accessible with useLocation
.
See React Router - useLocation for more details.