refactor(csv-column-read2dom): get rid of excess file app/components/input.jsx
This commit is contained in:
parent
98497ec1d6
commit
e63f058e35
|
@ -1,27 +0,0 @@
|
|||
import React from 'react';
|
||||
|
||||
const Input = () => {
|
||||
const handleChange = (e) => {
|
||||
const reader = new FileReader();
|
||||
reader.onload = () => {
|
||||
// @ts-ignore
|
||||
document.getElementById('out').innerHTML = reader.result;
|
||||
};
|
||||
// start reading the file. When it is done, calls the onload event defined above.
|
||||
// @ts-ignore
|
||||
reader.readAsBinaryString(document.getElementById('csv-input').files[0]);
|
||||
};
|
||||
return (
|
||||
<>
|
||||
<h3>Input</h3>
|
||||
<input
|
||||
accept=".csv"
|
||||
id="csv-input"
|
||||
onChange={handleChange}
|
||||
type="file"
|
||||
/>
|
||||
<pre id="out"><p>File contents will appear here</p></pre>
|
||||
</>
|
||||
);
|
||||
};
|
||||
export default Input;
|
Loading…
Reference in New Issue