novdom/reference

Reference a component. This is way less overhead than using a State for this purpose.

Types

pub opaque type Reference

Options for the reference type.

pub type ReferenceType {
  Value
  InnerHTML
}

Constructors

  • Value

    Reference the component’s value. (Useful for input fields)

  • InnerHTML

    Reference the component’s inner HTML. (Useful for divs, spans, etc.)

Functions

pub fn create() -> Reference

Create a new reference.
The reference still needs to be set to a component.

pub fn set(ref: Reference, ref_type: ReferenceType) -> Parameter

Set the reference to a component. See ReferenceType for more information.

pub fn value(ref: Reference) -> String

Read the reference’s value.

Search Document