Skip to content

Instantly share code, notes, and snippets.

@Manntrix
Created April 16, 2023 08:36
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Manntrix/bb78ebf80995c889d4f31ad5b1740fba to your computer and use it in GitHub Desktop.
Save Manntrix/bb78ebf80995c889d4f31ad5b1740fba to your computer and use it in GitHub Desktop.
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