@ducor/react
Version:
admin template ui interface
20 lines (19 loc) • 733 B
JavaScript
import { useContext } from "react";
import { HtmlDirectionContext } from "../provider/HtmlDirectionProvider";
/**
* Custom hook to manage HTML direction.
*
* @returns {useHtmlDirectionReturn} An object containing HTML direction information and functions to change the direction.
* @throws Will throw an error if the hook is used outside of an HtmlDirectionProvider.
*/
var useHtmlDirection = function () {
var context = useContext(HtmlDirectionContext);
if (!context) {
throw new Error("useHtmlDirection must be used within an HtmlDirectionProvider");
}
return {
htmlDirection: context.htmlDirection,
setHtmlDirection: context.setHtmlDirection,
};
};
export default useHtmlDirection;