show preview of input image javascript react
const React = require('react')
class Upload extends React.Component {
constructor(props){
super(props)
this.state = {
file: null
}
this.handleChange = this.handleChange.bind(this)
}
handleChange(event) {
this.setState({
file: URL.createObjectURL(event.target.files[0])
})
}
render() {
return (
<div>
<input type="file" onChange={this.handleChange}/>
<img src={this.state.file}/>
</div>
);
}
}
module.exports = Upload
Also in JavaScript:
- get selected text js
- regular expression start and end with same character javascript
- create element javascript with id
- navigate to route and refresh angular 6
- check whether a checkbox is checked in jQuery
- disable textbox on plumsail
- ionic 5 side menu example
- how to destructure complex objects
- javascript toggle button
- dconf-editor install
- SERVER PORT NODE.JS
- what does function setup() do in javascript
- npm start react
- const{}=
- how do I use const in javascript
- for elem in list javascript
- how to send a message using discord.js
- how to filter data from mongodb date in reactjs
- javascript console.table
- insertion sort javascript
- Find channel discord js
- javascript foreach key value
- event.target javascript
- How to abreviate digits in js