@nosto/search-js
    Preparing search index...

    Function createExtendableStore

    • Create an extendable Nosto store with any state object.

      Type Parameters

      Parameters

      • defaultState: State

        Default state object.

      • overrides: Partial<State> = {}

        Initial state overrides.

        While not as powerful as established store management libraries, Nosto store is a viable way to manage state in your app. This store may be useful for smaller deployments or when you want to avoid the complexity of a larger library.

      Returns {
          clearOnChange: <T>(callback: (piece: T) => void) => void;
          getInitialState: () => State;
          getState: () => State;
          onChange: <T>(
              selector: (state: State) => T,
              callback: (piece: T) => void,
          ) => void;
          onInit: (callback: () => void) => void;
          updateState: (newState: Partial<State>) => void;
      }