• Type Parameters

    • T

    Parameters

    • data: T[]
    • entry: T

      A new entry to append to the array.

    • OptionalgetUniqueMethod: ((entry: T) => unknown)

      Method to retrieve a value of an entry that is unique to it. This enables the method to replace existing value if it matches the unique value.

        • (entry): unknown
        • Parameters

          • entry: T

          Returns unknown

    Returns T[]

    • Returns a new array with the new entry appended.

    appendToFrozenArray

    • Inserts or replaces an entry in a frozen array and returns a new array.
    const entry = {id: 'myKey', value: 'myValue'};
    const newDataSet = appendToFrozenArray(myState.getValue(), entry, x => x.id === id);
    myState.setValue(newDataSet);
""