Type Alias StartStopNotifier<T>

StartStopNotifier: (
    set: (value: T) => void,
    update: (fn: Updater<T>) => void,
) => void | (() => void)

Start and stop notification callbacks. This function is called when the first subscriber subscribes.

Type Parameters

  • T

Type Declaration

    • (set: (value: T) => void, update: (fn: Updater<T>) => void): void | (() => void)
    • Parameters

      • set: (value: T) => void

        Function that sets the value of the store.

      • update: (fn: Updater<T>) => void

        Function that sets the value of the store after passing the current value to the update function.

      Returns void | (() => void)

      Optionally, a cleanup function that is called when the last remaining subscriber unsubscribes.