REACT get value from input field react - Net-Raft.com

Welcome aboard! We are happy you are here and wish you good net-raft!




Just a Web Code Solution

get value from input field using react


 264

REACT


2

import React from 'react';

class App extends React.Component {
constructor(props) {
super(props);
this.state = {value: ''};

this.handleChange = this.handleChange.bind(this);
this.handleSubmit = this.handleSubmit.bind(this);
}

handleChange(event) {
this.setState({value: event.target.value});
}

handleSubmit(event) {
alert(this.state.value);
event.preventDefault();
}

render() {
return (
<form onSubmit={this.handleSubmit}>
<label>
Your text:
<input type="text" value={this.state.value} onChange={this.handleChange} />
</label>
<button>submit</button>
</form>
);
}
}

export default App;


By     Created   
The power of the user (%)
8%



The most helpful REACT solutions

How to get client ip address using react ?How to get client ip address using react ?REACT

Click to see more ...

  4.4K     419

how to get the type of a device using react ?how to get the type of a device using react ?REACT

Click to see more ...

  1.4K     203

country dropdown using reactcountry dropdown using reactREACT

Click to see more ...

  813     127

How to get latitude and longitude using react/javascript ?How to get latitude and longitude using react/javascript ?REACT

Click to see more ...

  603     104

get ip address reactget ip address reactREACT

Click to see more ...

  364     80

time ago reacttime ago reactREACT

Click to see more ...

  281     73

detect mobile device reactdetect mobile device reactREACT

Click to see more ...

  251     58

get client country reactget client country reactREACT

Click to see more ...

  247     53

how to detect a mobile device not tablet using react ?how to detect a mobile device not tablet using react ?REACT

Click to see more ...

  227     51

detect browser reactdetect browser reactREACT

Click to see more ...

  257     36