Fluxible Router Fluxible 应用程序的路由。
特征:
同构路由
高阶组件处理历史和路径
nevigateAction 可用于改变路径
更新至 React 0.13
遵循磁通流动
示例代码:
var Fluxible = require('fluxible'); var Router = require('fluxible-router'); var React = require('react'); // Component var App = React.createClass({ mixins: [Fluxible.FluxibleMixin], // Calls onChange when storeListeners emit change statics: { storeListeners: [Store] }, getInitialState: function () { return this.getStore(Store).getState(); }, onChange: function () { this.setState(this.getStore(Store).getState()); }, render: function () { return <span>{this.state.foo}</span> } }); // App var fluxibleApp = new Fluxible({ component: App }); fluxibleApp.registerStore(Store); // Bootstrap var context = fluxibleApp.createContext(); context.executeAction(action, 'bar', function () { console.log(React.renderToString(context.createElement())); });