Вот моя форма в методе рендеринга, предназначенная для входа в систему пользователя.
<form onSubmit={this.handleSubmit}>
<Avatar className={classes.avatar}>
<LockOutlinedIcon />
</Avatar>
<Typography component="h1" variant="h5">
Sign in
</Typography>
<TextField variant="outlined" margin="normal" fullWidth id="email" label="Email Address" name="email"
onChange={this.handleEmailChange}
/>
<TextField variant="outlined" margin="normal" fullWidth
name="password" onChange={this.handlePasswordChange}
/>
{loginError && (
<Typography component="p" className={classes.errorText}>
Incorrect email or password.
</Typography>
)}
<Button type="button" fullWidth variant="contained" color="primary" className={classes.submit}
onClick={this.handleSubmit} >
Sign In
</Button>
</form>
и следующий мой метод отправки дескриптора
handleSubmit = () => {
const { dispatch } = this.props;
const { email, password } = this.state;
dispatch(loginUser(email, password));
};
Отправка работает при нажатии кнопки, но нене работает на клавишу ввода. Обратите внимание, что я использую кнопку от import Button from "@material-ui/core/Button";