/*
 * @Author: 吴永生#A02208 yongsheng.wu@wholion.com
 * @Date: 2022-06-13 16:50:40
 * @LastEditors: 吴永生#A02208 yongsheng.wu@wholion.com
 * @LastEditTime: 2022-06-13 21:09:24
 * @FilePath: /bkunyun/src/hooks/useGlobalStore.ts
 * @Description: 这是默认设置,请设置`customMade`, 打开koroFileHeader查看配置 进行设置: https://github.com/OBKoro1/koro1FileHeader/wiki/%E9%85%8D%E7%BD%AE
 */
import { useContext } from 'react';
import { MobXProviderContext } from 'mobx-react';
import { Stores } from '@/store';


export default function useGlobalStore<T extends keyof Stores>(storeName: T) {
  const context = useContext(MobXProviderContext) as Stores;
  return context[storeName];
}