Вылетает ошибка event.preventDefault is not a function в бработчике формы. Уже перечитал кучу всего по этой теме и не могу понять почему так происходит
`import React from 'react';
class App extends React.Component {
state ={
email: '',
password: '',
formSubmitted: false,
}
checkForm = (event) =>{
event.preventDefault();
if(this.state.email === '' && this.state.password === ''){
console.log('Enter credentials')
} else {
console.log('Welcome');
this.setState({formSubmitted: true})
}
}
handleChengeEmail = (event) =>{
event.preventDefault();
const{target: {value}} = event;
this.setState({email: value})
}
handleChengePass = (event) =>{
event.preventDefault();
const{target: {value}} = event;
this.setState({password: value})
}
render() {
return (
<form onSubmit={(e)=>this.checkForm(e)}>
<input
placeholder="Email"
onChange={this.handleChengeEmail}
value={this.state.email}
disabled={this.state.formSubmitted}
/>
<input
type="password"
placeholder="Password"
onChange={this.handleChengePass}
value={this.state.password}
disabled={this.state.formSubmitted}
/>
<button onClick={this.checkForm(this.state)}>Login</button>
</form>
);
}
}
export default App;
`