Files
parcer/src/context/browserActions.tsx

21 lines
593 B
TypeScript
Raw Normal View History

2024-07-24 19:29:52 +05:30
import React, { createContext, useState, useContext, ReactNode } from 'react';
interface ActionContextType {
getText: boolean;
getScreenshot: boolean;
handleGetText: () => void;
handleGetScreenshot: () => void;
resetActions: () => void;
}
2024-07-24 19:30:22 +05:30
const ActionContext = createContext<ActionContextType | undefined>(undefined);
export const useActionContext = (): ActionContextType => {
const context = useContext(ActionContext);
if (context === undefined) {
throw new Error('useActionContext must be used within an ActionProvider');
}
return context;
};