I am working on reactjs app and I am stuck on adding a property dynamically.
I have email input field and a submit button and when a submit button is clicked I want to add error message if email is not valid. Here is what I have done so far...
<TextField label='Email'/>
<Button onPress()=>this.doSomethingFunction() />
I want to doSomethingfunction() to dynamically add error property as follows
<TextField label='Email' error="invalid entry"/>
the problem I am facing is if I leave error property, as shown above, the error message appears even before user enters email address. The solution I am thinking of is to add the property after finding out if it is not valid but I dont how to do it dynamically.