• Type Parameters

    • T

    Parameters

    • data: T[]

      An array of objects.

    • entry: T

      The object to insert or replace with.

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

      Method to get the unique value of an entry.

        • (entry): unknown
        • Parameters

          • entry: T

          Returns unknown

    • index: number

    Returns T[]

    pushToUniqueArray

    • Append or replaces an item of an Array.
    const entry = {key: 'myKey', value: 'myValue'};
    const newDataSet = pushToUniqueArray([], entry, x => x.key === key, 1);
    myState.setValue(newDataSet);
""