Struct vertigo::dev::VDomComponent
source · [−]pub struct VDomComponent {
pub id: VDomComponentId,
pub view: Computed<VDomElement>,
}
Expand description
A component is a virtual dom element with render function attached to it.
Usually used as a main component for the application.
use vertigo::{Computed, Dependencies, dev::VDomComponent, VDomElement, html};
// Here some driver should be used instead of pure dependency graph.
let deps = Dependencies::default();
let state = deps.new_computed_from(5);
fn comp_render(state: &Computed<i32>) -> VDomElement {
html! { <p>{*state.get_value()}</p> }
}
let main_component = VDomComponent::new(state, comp_render);
Fields
id: VDomComponentId
view: Computed<VDomElement>
Implementations
pub fn new<T: PartialEq + 'static>(
params: Computed<T>,
render: fn(_: &Computed<T>) -> VDomElement
) -> VDomComponent
pub fn from_value<T: PartialEq + 'static>(
params: Value<T>,
render: fn(_: &Value<T>) -> VDomElement
) -> VDomComponent
Trait Implementations
Performs the conversion.
Auto Trait Implementations
impl !RefUnwindSafe for VDomComponent
impl !Send for VDomComponent
impl !Sync for VDomComponent
impl Unpin for VDomComponent
impl !UnwindSafe for VDomComponent
Blanket Implementations
Mutably borrows from an owned value. Read more