arch-js / arch

Web application framework for React by Red Badger
BSD 3-Clause "New" or "Revised" License
170 stars 13 forks source link

Allow default params in router #3

Closed charypar closed 9 years ago

charypar commented 9 years ago

It would be useful to have the ability to pass in anonymous/default props which would be merged into the props we already pass.

page \/, home, voting: false
page \/vote, home, voting: true
page \/vote/:selection, home

Originally requested by @tabazevedo

tabazevedo commented 9 years ago

Fixed a while ago. page now takes 3 arguments to define a route. The route string, the route component it maps to and a pre-render function which gives you the state cursor, the route context with the url and any vars/query params and a callback you can call to tell the application you're done preloading/preprocessing whatever you needed. page '/', home, (state, context, callback) -> callback!