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

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




Together We Can Simplify The World
Just a Web Code Solution

get value from input field using react


 177

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 (%)
7%



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 ...

  3.3K     407

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.1K     203

country dropdown using reactcountry dropdown using reactREACT

Click to see more ...

  616     128

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

Click to see more ...

  417     104

get ip address reactget ip address reactREACT

Click to see more ...

  310     81

time ago reacttime ago reactREACT

Click to see more ...

  228     74

detect mobile device reactdetect mobile device reactREACT

Click to see more ...

  203     59

get client country reactget client country reactREACT

Click to see more ...

  154     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 ...

  135     51

detect browser reactdetect browser reactREACT

Click to see more ...

  152     36

Hi net-rafter,
create the complete solutions that will be
used by the developers from all around the world.

join us - click to create your account