Creates a store with plugins.

// in hook file, e.g., store.ts
export const useMyRGS = create<type>(key, value, plugins);

// in component file
const [state, setState] = useMyRGS();
  • Type Parameters

    • T

    Parameters

    • key: string

      Unique key to identify the store.

    • Optionalvalue: T

      Initial value of the store.

    • Optionalplugins: Plugin<T>[]

      Plugins to be applied to the store.

    Returns () => [T, SetStateAction<T>]

    • A hook function that returns a tuple (Ordered sequence of values) containing the state and a function to set the state.