February 2019
Beginner to intermediate
180 pages
4h 4m
English
Now that we've defined the router, we can rewrite our navigation menu links to use the <NavLink /> component instead of the raw anchor link directly:
<li> <Router.NavLink href="/"> (ReasonReact.string("Home")) </Router.NavLink></li>
Wherever we want to display the current page's title, we can simply access the title field on the current route:
<h1> (ReasonReact.string(currentRoute.title)) </h1>
And, we can render a route's associated component in a similar way:
<main> currentRoute.component </main>
It's important to emphasize that ReasonReact's router does not dictate what the callback of watchUrl should do. In our case, we trigger an action that updates the current route, which is just an arbitrary record. It's completely reasonable ...
Read now
Unlock full access