1
Fork 0
mirror of https://github.com/Steffo99/bluelib.git synced 2024-12-22 11:34:21 +00:00

Add useBluelibInBody hook

This commit is contained in:
Steffo 2022-02-09 13:50:26 +01:00
parent 49e5fcd3bb
commit 241731cad6
Signed by: steffo
GPG key ID: 6965406171929D01
2 changed files with 17 additions and 0 deletions

View file

@ -0,0 +1,16 @@
import { useRef, useEffect } from "react"
import { useBluelib } from "./useBluelib"
export function useBluelibInBody(theme) {
const ref = useRef<HTMLBodyElement | null>(null)
useEffect(
() => {
ref.current = document.body as HTMLBodyElement
},
[ref]
)
useBluelib(ref, {
theme,
})
}

View file

@ -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"