[][src]Function rust_fel::re_render

pub fn re_render(rust_fel_element: Element, id: Option<String>)

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

  1. Passing the function a new rust_fel::Element who invoked re_render by updating itself.
  2. Finding the associated DOM Element by id.
  3. Removing the DOM Node and all of it's children.
  4. Replacing the removed DOM Node with the new rust_fel::Element.

Arguments

Examples

This example is not tested
   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()));
    }