Open
Description
Hi lukidoescode!
Thank you for this crate, I find it very useful and like the approach coming from css-in-js in React world.
I am facing the following problem: it seems that the stale styles added to page head by the component rendering are not being removed/replaced when component gets redrawn. This leads to increasing number of nodes in the page and eventually it slows down.
I use Yew integration as suggested in the example and not sure if this is a problem with css_in_rust or yew itself? Can I somehow clean it myself?
impl Component for MyComponent {
type Message = ();
type Properties = MyComponentProps;
fn create(props: Self::Properties, link: ComponentLink<Self>) -> Self {
let style = Style::create(
"MyComponent",
r#"
width: 100%;
"#)
.unwrap();
MyComponent {
link,
props,
style
}
}
fn update(&mut self, msg: Self::Message) -> ShouldRender {
false
}
fn change(&mut self, props: Self::Properties) -> ShouldRender {
let should_render = self.props.neq_assign(props);
should_render
}
fn view(&self) -> Html {
html! {
<div class=self.style.clone()>
{"Hello!"}
</div>
}
}
}
Thanks for any suggestions.
Metadata
Metadata
Assignees
Labels
No labels