diff --git a/src/hooks/useBluelibInBody.tsx b/src/hooks/useBluelibInBody.tsx new file mode 100644 index 0000000..e7f2c26 --- /dev/null +++ b/src/hooks/useBluelibInBody.tsx @@ -0,0 +1,16 @@ +import { useRef, useEffect } from "react" +import { useBluelib } from "./useBluelib" + +export function useBluelibInBody(theme) { + const ref = useRef(null) + useEffect( + () => { + ref.current = document.body as HTMLBodyElement + }, + [ref] + ) + + useBluelib(ref, { + theme, + }) +} \ No newline at end of file diff --git a/src/index.ts b/src/index.ts index 56de9f9..915dcc9 100644 --- a/src/index.ts +++ b/src/index.ts @@ -60,3 +60,4 @@ export {Bluelib as default} from "./components/Bluelib" export {usePromise} from "./hooks/usePromise" export {useFormState} from "./hooks/useFormState" export {useBluelib} from "./hooks/useBluelib" +export {useBluelibInBody} from "./hooks/useBluelibInBody"