feat: action context & hook
This commit is contained in:
@@ -8,3 +8,13 @@ interface ActionContextType {
|
|||||||
resetActions: () => void;
|
resetActions: () => void;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
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;
|
||||||
|
};
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user