How to create a route from string? #2140
Replies: 2 comments
-
You might want to have a capture group in the router. If you are on 0.18 #[derive(Switch)]
enum AppRoute {
#[to="/new-route/{name}"]
ViewPost(String),
} The relevant docs: If you are on master, the router is more polished and the docs have better instructions: |
Beta Was this translation helpful? Give feedback.
-
If you can build an instance of your If that is not an option and you are using |
Beta Was this translation helpful? Give feedback.
-
In my code I am getting a response from FetchService (inside the 'update' method). Depending on that I need to dynamically change the route.
I was thinking to send a message with a new route... But how I can create a route from "/new-route" string? Is that the right approach?
What is correct approach to change routes from 'update'?
Beta Was this translation helpful? Give feedback.
All reactions