Skip to content

Change route without <a> or full reload #1282

Answered by gbj
dikkadev asked this question in Q&A
Discussion options

You must be logged in to vote

Here's an example of how to use use_navigate to navigate programmatically. I think the use_navigate docs and this example should be plenty to get started on what you're trying to do but feel free to ask if you need more help.

// use_navigate allows you to navigate programmatically by calling a function
let navigate = use_navigate(cx);
view! { cx,
<>
// note: this is just an illustration of how to use `use_navigate`
// <button on:click> to navigate is an *anti-pattern*
// you should ordinarily use a link instead,
// both semantically and so your link will work before WASM loads

Replies: 2 comments 1 reply

Comment options

You must be logged in to vote
1 reply
@dikkadev
Comment options

Answer selected by dikkadev
Comment options

You must be logged in to vote
0 replies
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
3 participants