Как записать и читать из строки текстовых файлов по строке с помощью javaScript

// For react you have fist to import the file you want to read from 

import file from './output.txt';

export function readTextFile(){
    fetch(file)
        .then(response => (response.text()))
        .then(data => {
            // Do something with your data
            console.log(data)
        });
}
Dina TAKLIT