# Function createStore

- createStore<T extends StoreValueMapType, A extends StoreActionMapType = {}>(
  actionHandler: StoreActionMapHanlder<T, keyof T, A>,
  ): {
  StoreProvider: typeof StoreProvider;
  useStore<K extends string | number | symbol>(
  names: K[],
  ): [values: Pick<T, K>, setValues: (values: Pick<T, K>) => void];
  useStoreAction<
  N extends string
  | number
  | symbol,
  F extends (...args: any[]) => any,
  >(
  actionName: N,
  ): F;
  useStoreSetter<K extends string | number | symbol>(
  names: K[],
  ): (values: Pick<T, K>) => void;
  watchStore<K extends string | number | symbol>(
  names: K[],
  callback: (values: Pick<T, K>, prevValues: Pick<T, K>) => void,
  deps?: DependencyList,
  ): void;
  }

  #### Type Parameters

  - T extends StoreValueMapType
  - A extends StoreActionMapType = {}

  #### Parameters

  - actionHandler: StoreActionMapHanlder<T, keyof T, A>

  #### Returns {
  StoreProvider: typeof StoreProvider;
  useStore<K extends string | number | symbol>(
  names: K[],
  ): [values: Pick<T, K>, setValues: (values: Pick<T, K>) => void];
  useStoreAction<
  N extends string
  | number
  | symbol,
  F extends (...args: any[]) => any,
  >(
  actionName: N,
  ): F;
  useStoreSetter<K extends string | number | symbol>(
  names: K[],
  ): (values: Pick<T, K>) => void;
  watchStore<K extends string | number | symbol>(
  names: K[],
  callback: (values: Pick<T, K>, prevValues: Pick<T, K>) => void,
  deps?: DependencyList,
  ): void;
  }

  - ##### StoreProvider: typeof StoreProvider

    Store Provider. 内部组件均可和 store 交互

  - ##### useStore: function

    - useStore<K extends string | number | symbol>(
      names: K[],
      ): [values: Pick<T, K>, setValues: (values: Pick<T, K>) => void]

      使用 Store

      #### Type Parameters

      - K extends string | number | symbol

      #### Parameters

      - names: K[]

        获取的 Store 字段

      #### Returns [values: Pick<T, K>, setValues: (values: Pick<T, K>) => void]

      [值, 修改值方法]

      - Defined in lib/react/createStore.ts:161

  - ##### useStoreAction: function

    - useStoreAction<
      N extends string
      | number
      | symbol,
      F extends (...args: any[]) => any,
      >(
      actionName: N,
      ): F

      #### Type Parameters

      - N extends string | number | symbol
      - F extends (...args: any[]) => any

      #### Parameters

      - actionName: N

      #### Returns F

      - Defined in lib/react/createStore.ts:221

  - ##### useStoreSetter: function

    - useStoreSetter<K extends string | number | symbol>(
      names: K[],
      ): (values: Pick<T, K>) => void

      使用 Store (仅设置值)

      #### Type Parameters

      - K extends string | number | symbol

      #### Parameters

      - names: K[]

        获取的 Store 字段

      #### Returns (values: Pick<T, K>) => void

      修改值方法

      - Defined in lib/react/createStore.ts:190

  - ##### watchStore: function

    - watchStore<K extends string | number | symbol>(
      names: K[],
      callback: (values: Pick<T, K>, prevValues: Pick<T, K>) => void,
      deps?: DependencyList,
      ): void

      监听 Store 变化

      #### Type Parameters

      - K extends string | number | symbol

      #### Parameters

      - names: K[]

        Store 字段

      - callback: (values: Pick<T, K>, prevValues: Pick<T, K>) => void

        监听变化的回调函数

      - `Optional` deps: DependencyList

        依赖对象

      #### Returns void

      - Defined in lib/react/createStore.ts:205
  - Defined in lib/react/createStore.ts:143