Skip to content

How to add a hook to lifecycle after view!{} render out? #1561

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

You must be logged in to vote

Apologies, I missed this when you first posted it. I am assuming you mean that you want to run something on basically the tick after the component is rendered:

#[component]
pub fn SomeComp() -> impl IntoView {
    create_effect(|_| {
        request_animation_frame(|| {
            log!("view has rendered");
        });
    });
    view! {
        <div id="div_el_id"></div>
    }
}

Or do you mean something else by "after view render out"?

Replies: 2 comments 2 replies

Comment options

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

Comment options

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

Answer selected by tempbottle
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