Class Ref<T>

java.lang.Object
megalodonte.base.components.Ref<T>
Type Parameters:
T - the type of component held
All Implemented Interfaces:
megalodonte.contracts.RefContract<T>

public class Ref<T> extends Object implements megalodonte.contracts.RefContract<T>
A mutable reference holder for components. Analogous to React's useRef — allows a parent to access a child component after render.
  • Constructor Details

    • Ref

      public Ref()
    • Ref

      public Ref(T initial)
  • Method Details

    • current

      public T current()
      Specified by:
      current in interface megalodonte.contracts.RefContract<T>
    • setCurrent

      public void setCurrent(T component)
      Specified by:
      setCurrent in interface megalodonte.contracts.RefContract<T>