Skip to content

Render when button pressed #2021

Closed Answered by Tahinli
Tahinli asked this question in Q&A
Discussion options

You must be logged in to vote

Okay I found the solution in -> https://dioxuslabs.com/learn/0.5/reference/use_resource
I used restart() and here is my full code, as if someone also may need in the future.

Here is the part that, you may wanted to see

fn coin_status_renderer() -> Element {
    let mut coin_response = use_resource(move || coin_status_check());
    match &*coin_response.value().read() {
        Some(Ok(coin_status)) => {
            rsx! {
                button { 
                    //This is the place, where joke happens
                    onclick: move |_| coin_response.restart(),
                    "style":"width: 70px; height: 40px;",
                    "Coin Flip"
                }
                

Replies: 1 comment

Comment options

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