I am confused about why I cannot clear <input> field values using this simple pattern with React:
onComponentDidMount: function () {
this.clearFields();
},
clearFields: function () {
document.getElementById('username_field').value = '';
document.getElementById('password_field').value = '';
},
I don't think it's a problem with React, I think there some other issue at hand but I am not sure what's going on. But the fields definitely do not clear out. Later on, I can call this.clearFields() and that function does work as expected, but not when the component first mounts.