You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Take inspiration from React Refs to get references to elements in the DOM
src/html/mod.rs
/// Wrapped Element reference for later use in Component lifecycle methods.#[derive(PartialEq)]pubstructElementRef(RefCell<Option<Element>>);implDefaultforElementRef{fndefault() -> Self{ElementRef(RefCell::default())}}implElementRef{/// Get the wrapped Element reference if it existspubfnget(&self) -> Option<Element>{self.0.borrow().clone()}/// Place an Element in a reference for later usepubfnset(&self,element:Element){*self.0.borrow_mut() = Some(element);}}
jstarry
changed the title
Add support for setting refs on elements for later reference
Add support for setting refs on elements for DOM reference
Sep 27, 2019
Proposal
Take inspiration from React Refs to get references to elements in the DOM
src/html/mod.rs
my_component.rs
The text was updated successfully, but these errors were encountered: