-
I want to set the width of the canvas and this obviously doesn't work on sever. But I couldn't find anything on running this only on client. How do I do that? #[component]
pub fn Spider() -> impl IntoView {
let canvas_ref = create_node_ref::<html::Canvas>();
// let canvas_node = canvas_ref.get().unwrap();
// canvas_node.set_width(canvas_node.offset_width() as u32);
// canvas_node.set_height(canvas_node.offset_height() as u32);
view! {
<canvas node_ref=canvas_ref class=styles::canvas />
}
} |
Beta Was this translation helpful? Give feedback.
Answered by
gbj
Oct 17, 2024
Replies: 1 comment
-
https://book.leptos.dev/ssr/24_hydration_bugs.html#not-all-client-code-can-run-on-the-server |
Beta Was this translation helpful? Give feedback.
0 replies
Answer selected by
s1n7ax
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
https://book.leptos.dev/ssr/24_hydration_bugs.html#not-all-client-code-can-run-on-the-server