ReactTestVarF

japgolly.scalajs.react.test.ReactTestVarF
See theReactTestVarF companion object
class ReactTestVarF[F[_], A](val initialValue: A)(implicit val sync: Sync[F])

Houses a variable and provides React-like access to it.

Provides mock-like instances of the following:

  • Reusable functions
  • StateAccess
  • StateSnapshot
  • StateSnapshot with Reusability

It also keeps a log of changes, accessible via .history().

Type parameters

A

The variable type.

Attributes

Since

0.11.0

Companion
object
Graph
Supertypes
class Object
trait Matchable
class Any

Members list

Value members

Concrete methods

def history(): Vector[A]

Log of state values since initialised or last reset.

Log of state values since initialised or last reset.

Changes are ordered from oldest to newest.

The initial value is also included and is always the first element.

Attributes

def modValue(f: A => A): Unit
def modValueOption(f: A => Option[A]): Unit
def onUpdate(callback: => Unit): Unit
def reset(): Unit
def resetData(): Unit
def resetListeners(): Unit
def setValue(a: A): Unit
def stateSnapshot(): StateSnapshot[A]
def stateSnapshotWithReuse()(implicit r: Reusability[A]): StateSnapshot[A]
override def toString: String

Returns a string representation of the object.

Returns a string representation of the object.

The default representation is platform dependent.

Attributes

Returns

a string representation of the object.

Definition Classes
Any
def value(): A

Concrete fields

val initialValue: A
val setStateFn: Reusable[A => F[Unit]]
val setStateOptionCBFn: Reusable[(Option[A], F[Unit]) => F[Unit]]
lazy val stateAccess: StateAccess[F, Async, A]

Implicits

Implicits

implicit val sync: Sync[F]