With react-router
I can use the Link
element to create links which are natively handled by react router.
I see internally it calls t
with React-Router v4 on the horizon, there is now a new way of doing this.
import { MemoryRouter, BrowserRouter } from 'react-router';
const navigator = global && global.navigator && global.navigator.userAgent;
const hasWindow = typeof window !== 'undefined';
const isBrowser = typeof navigator !== 'undefined' && navigator.indexOf('Node.js') === -1;
const Router = isBrowser ? BrowserRouter : MemoryRouter;
react-lego is an example app that shows how to use/update react-router and it includes example functional tests which navigate the app.