pub fn re_render(rust_fel_element: Element, id: Option<String>)Expand description
Used when a rust_fel struct component updates it’s state and wants to propagate the changes
to it’s children.
After first mount this function will update the Virtual DOM and then the real DOM.
It works by
- Passing the function a new rust_fel::Element who invoked
re_renderby updating itself. - Finding the associated DOM Element by
id. - Removing the DOM Node and all of it’s children.
- Replacing the removed DOM Node with the new rust_fel::Element.
§Arguments
rust_fel_element- A rust_fel::Elementid- A String wrapped in an Option
§Examples
ⓘ
fn reduce_state(&mut self, message: Action) {
match message {
Action::Increment => self.0.borrow_mut().state += 5,
Action::Decrement => self.0.borrow_mut().state -= 5,
}
rust_fel::re_render(self.render(), Some(self.0.borrow().id.clone()));
}