pub fn mount(mut self, element: impl AppMount) {
        let parent = element.app_mount();
        let (receiver, sender) = app_message_channel();

        // Every component requires a render context, so provided a void context.
        let root_parent = Rc::new(RefCell::new(()));

        // The first render
        self.manager
            .render_walk(parent.as_ref(), None, root_parent.clone(), sender.clone())
            .unwrap();

        // Rerender when it receives update messages.
        receiver.react_on_message(move || {
            self.manager
                .render_walk(parent.as_ref(), None, root_parent.clone(), sender.clone())
                .unwrap();
        });
    }
/// Mounts the app on the given element in the DOM.
///
/// The element may be anything that implements
/// [AppMount](trait.AppMount.html). You may pass an id of an element
/// or an element node itself.
///
/// # Example
/// ```ignore
/// # #![feature(proc_macro_non_items, proc_macro_gen, decl_macro)]
/// #
/// # use ruukh::prelude::*;
/// # use wasm_bindgen::prelude::*;
/// #
/// # #[component]
/// # #[derive(Lifecycle)]
/// # struct MyApp;
/// #
/// # impl Render for MyApp {
/// #     fn render(&self) -> Markup<Self> {
/// #         html! {
/// #             "Hello World!"
/// #         }
/// #     }
/// # }
/// App::<MyApp>::new().mount("app");
/// ```
Mounts the app on the given element in the DOM.
The element may be anything that implements
[AppMount](trait.AppMount.html). You may pass an id of an element
or an element node itself.
Mounts the app on the given element in the DOM . The element may be anything that implements [ AppMount ] ( trait . AppMount . html ) . You may pass an id of an element or an element node itself .
pub fn mount(mut self, element: impl AppMount) {
        let parent = element.app_mount();
        let (receiver, sender) = app_message_channel();
        // Every component requires a render context, so provided a void context.
        let root_parent = Rc::new(RefCell::new(()));
        // The first render
        self.manager
            .render_walk(parent.as_ref(), None, root_parent.clone(), sender.clone())
            .unwrap();
        // Rerender when it receives update messages.
        receiver.react_on_message(move || {
            self.manager
                .render_walk(parent.as_ref(), None, root_parent.clone(), sender.clone())
                .unwrap();
        });
    }
pub fn mount ( mut self , element : impl AppMount ) { let parent = element . app_mount ( ) ; let ( receiver , sender ) = app_message_channel ( ) ; // Every component requires a render context, so provided a void context. let root_parent = Rc :: new ( RefCell :: new ( ( ) ) ) ; // The first render self . manager . render_walk ( parent . as_ref ( ) , None , root_parent . clone ( ) , sender . clone ( ) ) . unwrap ( ) ; // Rerender when it receives update messages. receiver . react_on_message ( move | | { self . manager . render_walk ( parent . as_ref ( ) , None , root_parent . clone ( ) , sender . clone ( ) ) . unwrap ( ) ; } ) ; }
Mounts the app on the given element in the DOM.
Mounts the app on the given element in the DOM .
mut self
element
impl AppMount
mut self
element
impl AppMount
example
None
#![feature(proc_macro_non_items, proc_macro_gen, decl_macro)]
None
use ruukh::prelude::*;
None
use wasm_bindgen::prelude::*;
None
#[component]
None
#[derive(lifecycle)]
None
struct myapp;
None
impl render for myapp {
None
fn render(&self) -> markup<self> {
None
html! {
None
"hello world!"
None
}
None
}
None
}
None