Struct yew::context::ContextProvider
source · Expand description
The context provider component.
Every child (direct or indirect) of this component may access the context value.
In order to consume contexts, Scope::context
method is used,
In function components the use_context
hook is used.
Trait Implementations§
source§impl<T: Clone + PartialEq + 'static> Component for ContextProvider<T>
impl<T: Clone + PartialEq + 'static> Component for ContextProvider<T>
§type Message = ()
type Message = ()
Messages are used to make Components dynamic and interactive. Simple
Component’s can declare their Message type to be
()
. Complex Component’s
commonly use an enum to declare multiple Message types. Read more§type Properties = ContextProviderProps<T>
type Properties = ContextProviderProps<T>
The Component’s properties. Read more
source§fn changed(&mut self, ctx: &Context<Self>, old_props: &Self::Properties) -> bool
fn changed(&mut self, ctx: &Context<Self>, old_props: &Self::Properties) -> bool
Called when properties passed to the component change Read more
source§fn view(&self, ctx: &Context<Self>) -> Html
fn view(&self, ctx: &Context<Self>) -> Html
Components define their visual layout using a JSX-style syntax through the use of the
html!
procedural macro. The full guide to using the macro can be found in Yew’s
documentation. Read moresource§fn update(&mut self, ctx: &Context<Self>, msg: Self::Message) -> bool
fn update(&mut self, ctx: &Context<Self>, msg: Self::Message) -> bool
Called when a new message is sent to the component via its scope. Read more
source§fn rendered(&mut self, ctx: &Context<Self>, first_render: bool)
fn rendered(&mut self, ctx: &Context<Self>, first_render: bool)
The
rendered
method is called after each time a Component is rendered but
before the browser updates the page. Read more