import { useState, useRef } from 'react';
import './App.css';

const App: React.FC = () => {
  const [name, setName] = useState('');
  const inputRef = useRef<HTMLInputElement>(null);

  function handleChange() {
    setName(inputRef.current?.value || '');
  }

  return (
    <div>
      <div>{name}</div>
      <input type="text" ref={inputRef} onChange={handleChange} />
    </div>
  );
};

export default App;

