Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

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)

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.