javascript: no se puede actualizar el estado con react-redux

Códigos

Escribí códigos leyendo algunas páginas web para principiantes.

src / components / Login.js

class Login extends React.Component { constructor(props) { super(props); this.state = { email: '', password: '', }; this.handleEmail = this.handleEmail.bind(this); this.handlePassword = this.handlePassword.bind(this); this.handleMainPage = this.handleMainPage.bind(this); } handleMainPage(){ this.props.onSubmit(this.state.email); } handleEmail(event) { this.setState({email: event.target.value}); } handlePassword(event) { this.setState({password: event.target.value}); } render() { return ( {amp}lt;Container component="main"{amp}gt; {amp}lt;CssBaseline /{amp}gt; {amp}lt;div{amp}gt; {amp}lt;Typography component="h1" variant="h5"{amp}gt; Login {amp}lt;/Typography{amp}gt; {amp}lt;form noValidate{amp}gt; {amp}lt;TextField value={this.state.email} onChange={this.handleEmail}/{amp}gt; {amp}lt;TextField value={this.state.password} onChange={this.handlePassword} type="password"/{amp}gt; {amp}lt;Button onClick={this.handleMainPage}{amp}gt; Sign In {amp}lt;/Button{amp}gt; {amp}lt;/form{amp}gt; {amp}lt;/div{amp}gt; {amp}lt;/Container{amp}gt; ) } } export default Login; 

src / container / Login.js

Понравилась статья? Поделиться с друзьями:
JavaScript & TypeScript
Adblock
detector