mirror of
https://github.com/hedgedoc/hedgedoc.git
synced 2025-03-15 04:52:44 +00:00
Fix use-on-ref-change.ts
Signed-off-by: Tilman Vatteroth <git@tilmanvatteroth.de>
This commit is contained in:
parent
a1fab0bb73
commit
1fb32584ab
1 changed files with 1 additions and 1 deletions
|
@ -11,7 +11,7 @@ import { useEffect, useRef } from 'react'
|
|||
export const useOnRefChange = <T>(reference: MutableRefObject<T>, onChange?: (newValue: T) => void): void => {
|
||||
const lastValue = useRef<T>()
|
||||
useEffect(() => {
|
||||
if (onChange && !equal(reference, lastValue.current)) {
|
||||
if (onChange && !equal(reference.current, lastValue.current)) {
|
||||
lastValue.current = reference.current
|
||||
onChange(reference.current)
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue