Material UI component reference does not work
You can also use inputRef
. This prop is available from material 1.0.
<TextField
className={classes.textField}
inputRef={input => (this._my_field = input)}
label="My field"
fullWidth
margin="normal"
defaultValue={this.props.my_field}
onChange={this.handleChange("dhis_password")}
/>
The on change let’s you update the state when it changes, but if you need to get the value unchanged, then the inputRef is necessary.
Also have a look at You can see this How to get password field value in react's material-ui
Try the following
let emailRef =React.createRef();
in the material-ui input field use inputRef
<TextField label="Email Address" name="email" inputRef ={emailRef} />
Just use inputRef
not ref