Skip to content

How to pass prop variables into view DSL #547

Answered by lukechu10
jlloh asked this question in Q&A
Discussion options

You must be logged in to vote

This is because the (...) in the view! macro implicitly creates a move || closure. and so does the href=.... This means that the value is moved into the first closure and then moved into the second closure which is not allowed because that would make the first one a FnOnce. One way to solve this is to either clone logout_url right before the if and else but inside the (...). Another way is to use logout_url = create_ref(format!(...)) instead and use logout_url.to_string() instead.

Replies: 2 comments

Comment options

You must be logged in to vote
0 replies
Answer selected by jlloh
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
2 participants