showing results for - "editable pre input react"
Matteo
10 Jan 2017
1import React, { useState } from 'react';
2
3function Example() {
4  const [url, setUrl] = useState("http://localhost:3000");
5
6  return (
7    <div>
8      <input type="text" value={url} onChange={(e) => setUtl(e.target.value)} />
9    </div>
10  );
11}
12
Théophile
25 Jan 2017
1class App extends Component {
2  constructor() {
3    super();
4    this.state = {
5      inputValue: 'http://localhost:3000'
6    };
7    this.handleChange = this.handleChange.bind(this);
8  }
9
10   handleChange(e){
11    console.log(e.target.value);
12    this.setState({inputValue: e.target.value});
13  }
14
15  render() {
16    return (
17      <div>
18        <input type="text" value={this.state.inputValue} onChange={this.handleChange} />
19      </div>
20    );
21  }
22}
23
similar questions
queries leading to this page
editable pre input react