https://github.com/sharpcoder/react-basic-router
A basic hash router for react.
https://github.com/sharpcoder/react-basic-router
react router routing-controllers view
Last synced: 10 months ago
JSON representation
A basic hash router for react.
- Host: GitHub
- URL: https://github.com/sharpcoder/react-basic-router
- Owner: SharpCoder
- License: mit
- Created: 2017-05-05T03:47:39.000Z (over 8 years ago)
- Default Branch: master
- Last Pushed: 2018-02-17T21:12:46.000Z (almost 8 years ago)
- Last Synced: 2025-02-02T06:32:45.173Z (11 months ago)
- Topics: react, router, routing-controllers, view
- Language: JavaScript
- Homepage: https://www.npmjs.com/package/react-basic-router
- Size: 25.4 KB
- Stars: 2
- Watchers: 3
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# React Basic Router
[](https://travis-ci.org/SharpCoder/react-basic-router) [](https://coveralls.io/github/SharpCoder/react-basic-router)
A fast and minimal view router written in react which responds to hash navigation.
## Getting Started
React basic router is just javascript, it can be webpacked or required as you like.
This is how you can install it.
```bash
npm install --save react-basic-router
```
## Example
In this eample, I assume "About" and "MainView" are react components. To load them, simply navigate normally to one of the hash links.
```jsx
import React from 'react';
import { Router, Route, ErrorRoute } from 'react-basic-router';
class App extends React.Component {
render() {
return(
);
}
}
```
* You can add _absolute_ to any route and it will not allow partial parameter matching. Without _absolute_, you can pass in querystring values in addition to the base route and it will still match just fine. In this way, you could navigate to (for example) mysite.com/#docs?findText=example
* All props other than component and hash, will be passed through to the underlying component.
* ErrorRoute will load when a page cannot be matched.
### Built With
* babel
* gulp
To build the project, run the following commands
```shell
npm install
npm install -g gulp
gulp
```
### Author
SharpCoder aka Joshua Cole