Alright, so my question is how I can add a prop to a component programmatically, here is my case, I have this in my render() for example:
<TextField
name="password"
variant="outlined"
label="Password"
type="password"
className={classNames(styles.signUpInputField, styles.override)}
onChange={this.handleChange}
onBlur={this.validate}
></TextField>
You can see this goes into a validate function, it's a lengthy one so I'll just give you an example and not my actual validate function:
validateEmail = event => {
if (event.target.name !== "email") {
///Set HelperText and error props here
}
};
What I want to happen is to modify props on my <TextField>, namely setting error= true and helperText= "some error here", How can I do this inside my function?
EDIT: I would need to avoid using states, as there are multiple fields that would need to be assigned exclusively, and multiple states for each is not a clean approach imo.