10 lines
346 B
TypeScript
10 lines
346 B
TypeScript
import { useContext } from "react";
|
|
import { UpdateContextValue, UpdateProviderContext } from "./UpdateProvider";
|
|
|
|
export function useUpdater() : UpdateContextValue {
|
|
const context = useContext(UpdateProviderContext);
|
|
if (!context) {
|
|
throw new Error("useUpdater must be used within an UpdateProvider");
|
|
}
|
|
return context;
|
|
} |