Fields
data: Rc<Data<Ms, Mdl>>
Implementations
sourceimpl<Ms: Clone + 'static, Mdl: Clone + 'static> App<Ms, Mdl>
impl<Ms: Clone + 'static, Mdl: Clone + 'static> App<Ms, Mdl>
We use a struct instead of series of functions, in order to avoid passing repetative sequences of parameters.
sourcepub fn update(&self, message: Ms)
pub fn update(&self, message: Ms)
This runs whenever the state is changed, ie the user-written update function is called. It updates the state, and any DOM elements affected by this change. todo this is where we need to compare against differences and only update nodes affected by the state change.
We re-create the whole virtual dom each time (Is there a way around this? Probably not without knowing what vars the model holds ahead of time), but only edit the rendered, web_sys dom for things that have been changed. We re-render the virtual DOM on every change, but (attempt to) only change the actual DOM, via web_sys, when we need. The model storred in inner is the old model; updated_model is a newly-calculated one.