same as useEffect but the dependencies array will recursively look down objects
Open console to see logs
import { useSignal } from "kaioken"
import { useEffectDeep } from "@kaioken-core/hooks"
const context = useSignal({
count: 0,
name: "",
})
useEffectDeep(() => {
console.log(
"I will trigger when count and name change",
"despite context being the same object reference"
)
}, [context.value])
const onClick = () => {
context.value.count += 1
context.notify()
}
const onInput: ElementProps<"input">["oninput"] = (e) => {
context.value.name = e.target.value
context.notify()
}
import { const useEffectDeep: (callback: () => void | (() => void), deps: unknown[]) => void
useEffectDeep } from "@kaioken-core/hooks"