mirror of
https://github.com/anidl/multi-downloader-nx.git
synced 2026-04-19 23:42:03 +00:00
12 lines
No EOL
393 B
TypeScript
12 lines
No EOL
393 B
TypeScript
import React from 'react';
|
|
import { StoreAction, StoreContext, StoreState } from '../provider/Store';
|
|
|
|
const useStore = () => {
|
|
const context = React.useContext(StoreContext as unknown as React.Context<[StoreState, React.Dispatch<StoreAction<keyof StoreState>>]>);
|
|
if (!context) {
|
|
throw new Error('useStore must be used under Store');
|
|
}
|
|
return context;
|
|
};
|
|
|
|
export default useStore; |