Created
April 16, 2023 08:36
-
-
Save Manntrix/bb78ebf80995c889d4f31ad5b1740fba 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 { useState } from "react"; | |
function App() { | |
const [file, setFile] = useState(null); | |
const handleFileChange = (e) => { | |
const file = e.target.files[0]; | |
setFile(file); | |
}; | |
return ( | |
<div className="App"> | |
<div> | |
<input type="file" onChange={handleFileChange} /> | |
<button onClick={uploadFile}>Upload</button> | |
</div> | |
</div> | |
); | |
} | |
export default App; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment