10 lines
304 B
TypeScript
10 lines
304 B
TypeScript
import { useContext } from "react";
|
|
import { StyleContext } from "./StyleProvider";
|
|
|
|
export const useStyle = () => {
|
|
const context = useContext(StyleContext);
|
|
if (context === undefined) {
|
|
throw new Error("useStyleContext must be used within a StyleProvider");
|
|
}
|
|
return context;
|
|
}; |