The below super simple code is not working as expected.
I am using react and injecting/providing props via redux store. what my understanding is store inject props in the React component.
To make this component work why I need both line1 and line 2 ?
import React from 'react';
import './sytles.css';
import { fetchUsers } from "./actions/userAction"
import { connect } from "react-redux"
@connect((store) => {
return {
signup: store.users,
};
})
class Signup extends React.Component {
handleClick(event) {
this.setState({email: event.target.value}) //line 1
this.props.signup.email = event.target.value; // line 2
}
render() {
return (
<input
type="text"
name="email"
value={this.props.signup.email}
onChange=
{ (event) => this.handleClick(event) }/>
);
}
}
export default Signup;