import { useState, useEffect } from 'react'; import { useHistory, useLocation } from 'umi'; import { useLocalStorageState } from 'ahooks'; interface UseTabsStoreParams { // localStore KEY to key: string; defaultValue: string; } export default function useTabsStore({ key, defaultValue, }: UseTabsStoreParams) { const [activeTabKey, setActiveTabKey] = useLocalStorageState( key, defaultValue, ); const handleTabChange = (key: string) => { setActiveTabKey(key); }; return { activeTabKey, handleTabChange, }; }