import React, { useEffect, useRef, useState } from '../../lib/teact/teact'; function TestUpdateRef() { const [isShown, setIsShown] = useState(true); // eslint-disable-next-line no-null/no-null const inputRef = useRef(null); // eslint-disable-next-line no-null/no-null const headingRef = useRef(null); useEffect(() => { // Input content should preserve, but ref should clean up // eslint-disable-next-line no-console console.log('!!!', inputRef.current); // Ref should update // eslint-disable-next-line no-console console.log('!!!', headingRef.current); }, [isShown]); return ( <>
setIsShown(!isShown)}> {isShown ? ( ) : ( )}
setIsShown(!isShown)}> {isShown ? (

Shown

) : (

Hidden

)}
); } export default TestUpdateRef;