Skip to content

Latest commit

 

History

History
21 lines (16 loc) · 509 Bytes

routing.md

File metadata and controls

21 lines (16 loc) · 509 Bytes

Routing

You can use any Router tool with DeLorean. In the example I use director as the router.

var Router = require('director').Router;

You may trig the action from View. So you can just do something like that:

var mainView = React.renderComponent(<ApplicationView dispatcher={TodoListDispatcher} />,
  document.getElementById('main'))

var appRouter = new Router({
  '/random': function () {
    TodoActionCreator.addTodo({text: Math.random()});
    location.hash = '/';
  }
});