Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/d-band/yax-router
Router plugin for yax (Using react-router)
https://github.com/d-band/yax-router
react-redux react-router redux yax yax-router
Last synced: about 3 hours ago
JSON representation
Router plugin for yax (Using react-router)
- Host: GitHub
- URL: https://github.com/d-band/yax-router
- Owner: d-band
- Created: 2017-05-31T04:18:37.000Z (over 7 years ago)
- Default Branch: master
- Last Pushed: 2020-06-01T01:23:52.000Z (over 4 years ago)
- Last Synced: 2024-09-09T10:54:17.593Z (2 months ago)
- Topics: react-redux, react-router, redux, yax, yax-router
- Language: JavaScript
- Size: 25.4 KB
- Stars: 4
- Watchers: 5
- Forks: 0
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
yax-router
==========[![NPM version](https://img.shields.io/npm/v/yax-router.svg)](https://www.npmjs.com/package/yax-router)
[![NPM downloads](https://img.shields.io/npm/dm/yax-router.svg)](https://www.npmjs.com/package/yax-router)
[![Build Status](https://travis-ci.org/d-band/yax-router.svg?branch=master)](https://travis-ci.org/d-band/yax-router)
[![Coverage Status](https://coveralls.io/repos/github/d-band/yax-router/badge.svg?branch=master)](https://coveralls.io/github/d-band/yax-router?branch=master)
[![Dependency Status](https://david-dm.org/d-band/yax-router.svg)](https://david-dm.org/d-band/yax-router)
[![Greenkeeper badge](https://badges.greenkeeper.io/d-band/yax-router.svg)](https://greenkeeper.io/)> Router plugin for [yax](https://github.com/d-band/yax) (Using react-router)
## Getting Started
### Install
```bash
$ npm install --save yax-router
```### Usage Example
- [HackerNews](https://github.com/d-band/yax-hackernews): HackerNews clone built with [yax](https://github.com/d-band/yax) and [yax-router](https://github.com/d-band/yax-router), based on [dva-hackernews](https://github.com/dvajs/dva-hackernews).
```javascript
import React from 'react';
import ReactDOM from 'react-dom';
import yax from 'yax';
import { Provider } from 'react-redux';
import { Route } from 'react-router';
import router, { Router, push } from 'yax-router';
import createHistory from 'history/createBrowserHistory';const history = createHistory();
const store = yax({
state: {},
reducers: {},
actions: {},
modules: {}
}, router(history));store
.onRoute('/', ({ match, location, dispatch }) => {});
.onRoute('/topics', ({ match, location, dispatch }) => {});
.onRoute('/topic/:id', ({ match, location, dispatch }) => {});const Home = () =>
Home;
const Topic = ({ match }) =>Topic{match.params.id};
const Topics = () =>Topics;// store.dispatch(push('/'));
ReactDOM.render(
,
document.getElementById('root')
);
```## Report a issue
* [All issues](https://github.com/d-band/yax-router/issues)
* [New issue](https://github.com/d-band/yax-router/issues/new)## License
yax-router is available under the terms of the MIT License.