Skip to content
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

Expose routeTo #259

Closed
psabharwal123 opened this issue Jan 9, 2018 · 8 comments
Closed

Expose routeTo #259

psabharwal123 opened this issue Jan 9, 2018 · 8 comments
Labels

Comments

@psabharwal123
Copy link

routeTo function would be helpful if one needs to "forward" instead of "redirect", basically not change the url in the address bar. example use case - default component forwards to /error/404

@developit
Copy link
Member

developit commented Jan 16, 2018

It's exposed already:

import { route } from 'preact-router';

route('/page-2')  // appends a history entry

route('/page-3', true)  // replaces the current history entry

Let me know if the docs didn't make this obvious :)

@psabharwal123
Copy link
Author

I am asking for 'routeto' not 'route'. Purpose being that i dont want the url in addressbar to change :)

@studentIvan
Copy link

@psabharwal123 if the pull request for #265 be applied you will able to extend the preact Router class and do what you want to do :)

@psabharwal123
Copy link
Author

thanks! hopefully someone can review and merge it soon :)

@psabharwal123
Copy link
Author

@studentIvan please have a look at your changes, one of them breaks minification so cant be merged

@Davetherave2010
Copy link
Contributor

Davetherave2010 commented Feb 28, 2018

I made a PR for this (#270) to get it added to the docs

@psabharwal123
Copy link
Author

Thanks but original request was to expose 'routeTo'

@developit
Copy link
Member

@psabharwal123 if you want to route without changing the URL, use createMemoryHistory from history.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

4 participants