Trait sauron_core::dom::Component
source · pub trait Component<MSG, XMSG> {
// Required methods
fn update(&mut self, msg: MSG) -> Effects<MSG, XMSG>;
fn view(&self) -> Node<MSG>;
// Provided methods
fn style(&self) -> String { ... }
fn get_component_id(&self) -> Option<&String> { ... }
}
Expand description
A component has a view and can update itself.
The update function returns an effect which can contain follow ups and effects. Follow ups are executed on the next update loop of this component, while the effects are executed on the parent component that mounts it.
Required Methods§
Provided Methods§
sourcefn get_component_id(&self) -> Option<&String>
fn get_component_id(&self) -> Option<&String>
Component can have component id to identify themselves
Implementors§
impl<CONT, MSG> Component<MSG, ()> for CONTwhere CONT: Container<MSG, ()> + CustomElement<MSG>, MSG: 'static,
Auto implementation of Component trait for Container, which in turn creates an Auto implementation trait for of Application for Container but only if that Container is intended to be a CustomElement