• Create a store similar to Svelte's derived, but which has its own set and update methods and can send values back to the origin stores. Read more...

    Type Parameters

    Parameters

    • origins: S

      One or more stores to derive from. Same as derived's 1st parameter.

    • derive: (values: StoresValues<S>) => T

      The callback to determine the derived value. Same as derived's 2nd parameter.

    • reflect: (reflecting: T, old: StoresValues<S>) => SetValues<S>

      Called when the derived store gets a new value via its set or update methods, and determines new values for the origin stores. Read more...

    • Optionalinitial: T

      The new store's initial value. Same as derived's 3rd parameter.

    Returns Writable<T>

    A writable store.

  • Create a store similar to Svelte's derived, but which has its own set and update methods and can send values back to the origin stores. Read more...

    Type Parameters

    Parameters

    • origins: S

      One or more stores to derive from. Same as derived's 1st parameter.

    • derive: (
          values: StoresValues<S>,
          set: (value: T) => void,
          update: (fn: Updater<T>) => void,
      ) => void

      The callback to determine the derived value. Same as derived's 2nd parameter.

    • reflect: (reflecting: T, old: StoresValues<S>) => SetValues<S>

      Called when the derived store gets a new value via its set or update methods, and determines new values for the origin stores. Read more...

    • Optionalinitial: T

      The new store's initial value. Same as derived's 3rd parameter.

    Returns Writable<T>

    A writable store.