JSFiddle - React, Tailwind, and code Playground

HTML

<input type='file' accept='text/plain' onchange='openFile(event)'>

JavaScript

const openFile = (e) => {
  const input = e.target;
  const reader = new FileReader();
  reader.readAsText(input.files[0]);
  reader.onload = () => {
    const text = reader.result;
    const result = text.split(/\r?\n/);
    console.log(result); // do something with array
  };
};