11 lines
315 B
TypeScript
11 lines
315 B
TypeScript
import { useContext } from "react";
|
|
import { ImageViewerContext } from "./ImageViewerProvider";
|
|
|
|
export function useImageViewer() {
|
|
const context = useContext(ImageViewerContext);
|
|
if(!context){
|
|
throw new Error("useImageViewer must be used within a ImageViewerProvider");
|
|
}
|
|
|
|
return context;
|
|
} |