How to make forms in reactjs?

Answer

Forms are really important for any website for login, signup. It is easy to make a form but forms in React work a little differently as compared to others.

Code:
import React from 'react';
import ReactDOM from 'react-dom';

class App extends React.Component {

state = { inputValue: '' };
render() {
return (
<div>
<form>
<label> Enter text </label>
<input type="text"
value={this.state.inputValue}
onChange={(e) => this.setState(
{ inputValue: e.target.value })}/>
</form>
<br/>
<div>
Entered Value: {this.state.inputValue}
</div>
</div>
);
}
}

ReactDOM.render(<App />,
document.querySelector('#root'));

All react js Questions

Ask your interview questions on react-js

Write Your comment or Questions if you want the answers on react-js from react-js Experts
Name* :
Email Id* :
Mob no* :
Question
Or
Comment* :
 





Disclimer: PCDS.CO.IN not responsible for any content, information, data or any feature of website. If you are using this website then its your own responsibility to understand the content of the website

--------- Tutorials ---