Reactjs – Changes for forming FormControl React

Hey so I have a text box/FormControl, it should update a field in json in this.state. I want to know if there is a better way to change it?

 type='text' 
placeholder='enter'
defaultValue={this.state.form. name}
onChange={this.handleChange.bind(this,'name')}
/>

`

handleChange(change, event) {
var toChange = this.state.form;
toChange[change] = event.target.value;
this.setState ({form: toChange});
}

The optimized handleChange method is as follows. (will Replace’username’ with the field name you like…)

 type='text'
name='username' < br /> placeholder='enter'
defaultValue={this.state.form.username}
onChange={this.handleChange.bind(this)}
/>
< /FormGroup>

handleChange(event) {
let fieldName = event.target.name;
let fleldVal = event.target.value;
this.setState( {form: {...this.state.form, [fieldName]: fleldVal}})
}

Hey so I have a text box/FormContro l, it should update a field in json in this.state. I want to know if there is a better way to change it?

 type='text' 
placeholder='enter'
defaultValue={this.state.form. name}
onChange={this.handleChange.bind(this,'name')}
/>

`

handleChange(change, event) {
var toChange = this.state.form;
toChange[change] = event.target.value;
this.setState ({form: toChange});
}

The optimized handleChange method is as follows. (Replace’username’ with the field name you like…)

 type='text'
name='username'
placeholder='enter'
defaultValue={this.state.form.username}
onChange={this.handleChange.bind(this)}
/>


handleChange (event) {
let fieldName = event.target.name;
let fleldVal = event.target.value;
this.setState({form: {...this.state.form , [fieldName]: fleldVal}})
}

WordPress database error: [Table 'yf99682.wp_s6mz6tyggq_comments' doesn't exist]
SELECT SQL_CALC_FOUND_ROWS wp_s6mz6tyggq_comments.comment_ID FROM wp_s6mz6tyggq_comments WHERE ( comment_approved = '1' ) AND comment_post_ID = 5954 ORDER BY wp_s6mz6tyggq_comments.comment_date_gmt ASC, wp_s6mz6tyggq_comments.comment_ID ASC

Leave a Comment

Your email address will not be published.