• 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.

    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);
    myState.setValue(newDataSet);
MMNEPVFCICPMFPCPTTAAATR