1class ImageUpload extends React.Component {
2 state = {
3 files: []
4 }
5
6 fileSelectedHandler = (e) => {
7 this.setState({ files: [...this.state.files, ...e.target.files] })
8 }
9
10 render() {
11 return (
12 <form>
13 <div><h2>Upload images</h2></div>
14 <h3>Images</h3>
15 <input type="file" multiple onChange={this.fileSelectedHandler} />
16 </form>
17 )
18 }
19}
20
21
22ReactDOM.render(<ImageUpload />, document.getElementById('app'))