useUpdateEffect
API
import useUpdateEffect from '@restart/hooks/useUpdateEffect'
useUpdateEffect
(fn: EffectCallback, deps: DependencyList) => voidRuns an effect only when the dependencies have changed, skipping the initial "on mount" run. Caution, if the dependency list never changes, the effect is never run
const ref = useRef<HTMLInput>(null);// focuses an element only if the focus changes, and not on mountuseUpdateEffect(() => {const element = ref.current?.children[focusedIdx] as HTMLElementelement?.focus()}, [focusedIndex])Parameters
fn
EffectCallbackdeps
DependencyList
Return Value void