My React component is like this:

export default function Player() {
  const [enteredPlayerName, setEnteredPlayerName] = useState();
  const playerName = useRef<HTMLInputElement>(null);

  function handleSubmitName() {
    if (playerName.current) {
      setEnteredPlayerName(playerName.current.value); // at this line i get type error
    }
  }

  return (
    <section id="player">
      <h1>Welcome {enteredPlayerName ?? "Unknown entity"}</h1>
      <p>
        <input type="text" ref={playerName} />
        <button onClick={handleSubmitName}>Set Name</button>
      </p>
    </section>
  );
}

Error content:

Argument of type 'string' is not assignable to parameter of type SetStateAction<undefined>.ts(2345)

What type must I use on useRef() for fixing this error?

1