Composer: Fix input tooltips

This commit is contained in:
Alexander Zinchuk 2022-01-28 02:12:10 +01:00
parent 9f7a77da4f
commit 479c4764eb

View File

@ -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).
// Useful for state values that update frequently (such as controlled input value).
export function useStateRef<T>(value: T) {
const ref = useRef<T>(value);
useEffect(() => {
useOnChange(() => {
ref.current = value;
}, [value]);