pub struct App<COMP: Component> { /* private fields */ }
Expand description
An instance of an application.
Implementations§
Source§impl<COMP> App<COMP>
impl<COMP> App<COMP>
Sourcepub fn mount(self, element: Element) -> ComponentLink<COMP>
pub fn mount(self, element: Element) -> ComponentLink<COMP>
The main entry point of a Yew program. It works similarly to the program
function in Elm. You should provide an initial model, update
function
which will update the state of the model and a view
function which
will render the model to a virtual DOM tree. If you would like to pass props,
use the mount_with_props
method.
Sourcepub fn mount_to_body(self) -> ComponentLink<COMP>
pub fn mount_to_body(self) -> ComponentLink<COMP>
Alias to mount("body", ...)
.
Sourcepub fn mount_as_body(self) -> ComponentLink<COMP>
pub fn mount_as_body(self) -> ComponentLink<COMP>
Alternative to mount
which replaces the body element with a component which has a body
element at the root of the HTML generated by its view
method. Use this method when you
need to manipulate the body element. For example, adding/removing app-wide
CSS classes of the body element.
Source§impl<COMP> App<COMP>where
COMP: Component,
impl<COMP> App<COMP>where
COMP: Component,
Sourcepub fn mount_with_props(
self,
element: Element,
props: COMP::Properties,
) -> ComponentLink<COMP>
pub fn mount_with_props( self, element: Element, props: COMP::Properties, ) -> ComponentLink<COMP>
The main entry point of a Yew program which also allows passing properties. It works
similarly to the program
function in Elm. You should provide an initial model, update
function which will update the state of the model and a view
function which
will render the model to a virtual DOM tree.
Sourcepub fn mount_to_body_with_props(
self,
props: COMP::Properties,
) -> ComponentLink<COMP>
pub fn mount_to_body_with_props( self, props: COMP::Properties, ) -> ComponentLink<COMP>
Alias to mount_with_props("body", ...)
.
Sourcepub fn mount_as_body_with_props(
self,
props: COMP::Properties,
) -> ComponentLink<COMP>
pub fn mount_as_body_with_props( self, props: COMP::Properties, ) -> ComponentLink<COMP>
Alternative to mount_with_props
which replaces the body element with a component which
has a body element at the root of the HTML generated by its view
method. Use this method
when you need to manipulate the body element. For example, adding/removing app-wide
CSS classes of the body element.
Trait Implementations§
Auto Trait Implementations§
impl<COMP> Freeze for App<COMP>
impl<COMP> !RefUnwindSafe for App<COMP>
impl<COMP> !Send for App<COMP>
impl<COMP> !Sync for App<COMP>
impl<COMP> Unpin for App<COMP>
impl<COMP> !UnwindSafe for App<COMP>
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T, V> IntoOptPropValue<V> for Twhere
T: IntoPropValue<Option<V>>,
impl<T, V> IntoOptPropValue<V> for Twhere
T: IntoPropValue<Option<V>>,
Source§fn into_opt_prop_value(self) -> Option<V>
fn into_opt_prop_value(self) -> Option<V>
self
to an optional value of a Properties
struct.Source§impl<T> IntoPropValue<Option<T>> for T
impl<T> IntoPropValue<Option<T>> for T
Source§fn into_prop_value(self) -> Option<T>
fn into_prop_value(self) -> Option<T>
self
to a value of a Properties
struct.Source§impl<T> IntoPropValue<T> for T
impl<T> IntoPropValue<T> for T
Source§fn into_prop_value(self) -> T
fn into_prop_value(self) -> T
self
to a value of a Properties
struct.