mirror of
https://github.com/danog/telegram-tt.git
synced 2025-01-21 21:01:29 +01:00
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).
|
||||
// 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]);
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user