This is a small example to build a simple routing solution for React.js instead of using the popular React Router.
It utilizes great libraries e.g. history and universal-router which are React-independent.
The example includes:
- A singleton
history
object for URL navigation - A
Router
component to route different child components - A
Link
component that acts as those in React Router or in React Static Boilerplate - An example component
App
to demostrate their usages
The example is inspired mostly by You Might not need React Router.
External dependencies are listed as follows:
react
: version 15.3.0history
: version 4.4.0universal-router
: version 2.0.0
Codes include the latest ES6/ES7 syntax e.g. function bind operator (::) and async/await.