Documentation
    Preparing search index...

    Class BufferedValue<T>

    BufferedValue is a utility class that holds a value and allows for efficient updates by checking if the new value is different from the current one using a custom (deep) equality function. If the values are different, it updates the value and returns true; otherwise, it returns false. This allows for reference stable values that can be used in contexts where reference equality is important, such as events or React state updates.

    The initial value to be buffered.

    An optional custom equality function to compare values. Defaults to a deep equality check using fast-deep-equal.

    Type Parameters

    • T

      The type of the value being buffered.

    Index

    Constructors

    Methods

    Constructors

    Methods

    • Parameters

      • newValue: T

        The new value to compare against the current buffered value.

      Returns boolean

      • Returns true if the new value is different from the current value, false otherwise.