Created
August 16, 2017 06:09
-
-
Save anisotropy/81072001fedb1b8a24d7ccd74bce0e91 to your computer and use it in GitHub Desktop.
자바스크립트(리액트)에서 텍스트 파일 읽기
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import React, {Component} from 'react'; | |
class Example extends Component { | |
handleChange(e){ | |
let file = e.target.files[0]; | |
let fileReader = new FileReader(); | |
fileReader.onload = () => { | |
console.log(fileReader.result); | |
}; | |
fileReader.readAsText(file); | |
} | |
render(){ | |
return ( | |
<div> | |
<input type="file" onChange={tihs.handleChange.bind(this)} /> | |
</div> | |
); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment