class App extends Component {
constructor() {
super();
this.state = {
inputValue: 'http://localhost:3000'
};
this.handleChange = this.handleChange.bind(this);
}
handleChange(e){
console.log(e.target.value);
this.setState({inputValue: e.target.value});
}
render() {
return (
<div>
<input type="text" value={this.state.inputValue} onChange={this.handleChange} />
</div>
);
}
}
import React, { useState } from 'react';
function Example() {
const [url, setUrl] = useState("http://localhost:3000");
return (
<div>
<input type="text" value={url} onChange={(e) => setUtl(e.target.value)} />
</div>
);
}
class App extends Component {
constructor() {
super();
this.state = {
inputValue: 'http://localhost:3000'
};
this.handleChange = this.handleChange.bind(this);
}
handleChange(e){
console.log(e.target.value);
this.setState({inputValue: e.target.value});
}
render() {
return (
<div>
<input type="text" value={this.state.inputValue} onChange={this.handleChange} />
</div>
);
}
}
import React, { useState } from 'react';
function Example() {
const [url, setUrl] = useState("http://localhost:3000");
return (
<div>
<input type="text" value={url} onChange={(e) => setUtl(e.target.value)} />
</div>
);
}