Faça o upload do arquivo de texto reage JS componente funcional

let files = document.querySelector('input[type="file"]').files;
    const reader = new FileReader();
    reader.onload = () => {
      const lines = reader.result;
      setText(lines);
    };
    reader.readAsText(files[0]);
};
mrmalik610