Hii I am new to React Js, After selecting count InputCount, I had generated input fields dynamically.Now I want to get the value for the inputs field and also I want to validate all the fields.
import React, { Component } from 'react';
class App extends Component {
constructor(props) {
super(props);
this.onChangeCount = this.onChangeCount.bind(this);
this.onSubmit = this.onSubmit.bind(this);
this.state = {,
InputCount: "",
}
}
onChangeCount(e) {
this.setState({
InputCount: e.target.value,
})
}
render() {
let options1 = []
for (let j = 0; j <= this.state.InputCount; j += 1) { options1.push(j); }
return (
{this.state.InputCount && (
options1.map((i) => {
return (<div>
<input type="text" name="name" placeholder="Name" /><br />
<input type="text" name="name" placeholder="RollNumber" />
</div>)
})
)}
please help me to get value from the input fields and also validate the form.
onChangeCountused? And whathandleChangedoes? You should give more clear code.