React Input Type not editable

Viewed 63325

I was adding dynamic values to the input file in react then I tried to edit that but it not at all editable.

var shop_profile_data = this.state.data.DETAILS;

<input id="shopname" className="inputMaterial"  value={shop_profile_data.NAME} type="text" required/>

Please give me the solution. Thanks

3 Answers

Try using defaultValue instead of value, defaultValue will set the value and also editable. The code will look like this:

<input id="shopname" className="inputMaterial"  defaultValue={shop_profile_data.NAME} type="text" required/>

reference: Uncontrolled Components – React

Related