Composer: Fix input tooltips
This commit is contained in:
parent
9f7a77da4f
commit
479c4764eb
@ -1,11 +1,13 @@
|
|||||||
import { useEffect, useRef } from '../lib/teact/teact';
|
import { useRef } from '../lib/teact/teact';
|
||||||
|
|
||||||
|
import useOnChange from './useOnChange';
|
||||||
|
|
||||||
// Allows to use state value as "silent" dependency in hooks (not causing updates).
|
// Allows to use state value as "silent" dependency in hooks (not causing updates).
|
||||||
// Useful for state values that update frequently (such as controlled input value).
|
// Useful for state values that update frequently (such as controlled input value).
|
||||||
export function useStateRef<T>(value: T) {
|
export function useStateRef<T>(value: T) {
|
||||||
const ref = useRef<T>(value);
|
const ref = useRef<T>(value);
|
||||||
|
|
||||||
useEffect(() => {
|
useOnChange(() => {
|
||||||
ref.current = value;
|
ref.current = value;
|
||||||
}, [value]);
|
}, [value]);
|
||||||
|
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user