feat: created `useTabContext` hook

pull/107/head
Samuel Rowe 3 years ago
parent 9b7ec85bdb
commit 0896996f22

@ -1,2 +1,3 @@
export * from "./useTitle";
export * from "./useAccordionState";
export * from "./useTabContext";

@ -0,0 +1,11 @@
import { useContext } from "react";
import { TabContext } from "../contexts";
import { ITabContext } from "../types";
export const useTabContext = (): ITabContext => {
const context = useContext(TabContext);
if (!context) {
throw new Error("Cannot find tab context.");
}
return context;
};
Loading…
Cancel
Save