I'm new to Reactjs and I'm having difficulty in making the input field that has a assign value. Please guys help me.
My js file.
<div className="col-sm-9">
<input className={this.state.editable ? "edit-profile" : "disable-profile disable"}
ref="fullName"
onChange={this._handleInputChange.bind(null, "fullName")}
value={user.fullName}/>
Run Code Online (Sandbox Code Playgroud)
My button
<button className="btn btn-default" onClick={this.edit}>
{this.state.editDone ? "Done" : "Edit Profile"}</button>
edit = () => {
if (!this.state.editDone) {
this.setState({ editable: true, editDone: true});
} else {
this.setState({ editable: false, editDone: false});
}
}
Run Code Online (Sandbox Code Playgroud)
css file
.edit-profile {
outline: 0;
color: …Run Code Online (Sandbox Code Playgroud)