New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Programmatical API #137
Comments
Not quite sure I understand - if you mean programmatically triggering a route you can use route(): import { route } from 'preact-router';
route('/foo'); |
Just re-read - for a routing table you would just use a function to convert your routes to children:
Each entry in the JSON would just have |
Preact's website actually does this by the way, here the implementation: https://github.com/developit/preact-www/blob/master/src/components/routes.js |
@developit thanks a lot! I'll share the result with you once I'm done. |
Perfect, that'll make a nice addition to the docs. |
@developit just released it; http://github.com/azer/go-preact-starter |
Awesome, nice work man. |
I'm working on a Go framework that needs to combine routing in one JSON document that can be read by both JS and Go. To accomplish this, I can't hard-code the routes, I need an API.
Is there an example of programmatical usage of preact-router? Documentation seem to not cover such a case.
The text was updated successfully, but these errors were encountered: