Ecosyste.ms: Awesome

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

Awesome Lists | Featured Topics | Projects

https://github.com/lin-xi/react-xrouter

react router
https://github.com/lin-xi/react-xrouter

Last synced: 15 days ago
JSON representation

react router

Awesome Lists containing this project

README

        

React-XRouter
====

>React-XRouter 是一个类似ReactRouter的类库。

--------

##依赖


--------

##安装:
>npm install react-xrouter --save

--------
## 使用

```

var Router = require('react-xrouter');

Router.route({
'/': {
enter: function () {
require.ensure([], function(require){
//可以做些统计写日志的工作
var HomePage = require('./pages/home/HomePage.js');
ReactDOM.render(, document.querySelector('#pinzhi'));
});
}
},
'/detail/:id': {
enter: function (param) {
require.ensure([], function(require){
var DetailPage = require('./pages/detail/DetailPage.js');
ReactDOM.render(, document.querySelector('#pinzhi'));
});
},
leave: function(){

}
},
'default': {
redirect: '/'
}
});

```

--------
## API

```

var Router = require('react-xrouter');

Router.back();

Router.redirect(path);

```