React Static Router
A tiny and simple static router for React.
Installation
Install using the NPM:
npm install -S react-static-router@development
Usage Example
For more detailed example see the website folder. The site was built to be self explainable and also an example.
import React from 'react';
import ReactDOM from 'react-dom';
import Router from 'react-static-router';
const Landing = () => {
return (
<div>Landing</div>
);
};
const routes = [{
pattern: '/',
getComponent() {
return new Promise(resolve => resolve(Landing));
}
}];
ReactDOM.render((
<Router pathname={ window.location.pathname } routes={ routes } />
), document.getElementById('root'));
License
MIT