The code is:
Test component:
import {add} from './../actions/';
class Test extends Component{
_add = (){
this.props.add(1);
}
render(){
<button onClick={this._add}>add</button>
}
}
const mapStateToProps = ()=>({
haha:'haha'
});
export default connect(
mapStateToProps,
{add}
)(Test)
Actions:
export const add = value => (dispatch) =>{
dispatch({
type:'ADD',
value:value
})
}
I click add button there has this error!
What's the issue?
I looked createStore.js and console.log(action). It shows a function.
But Redux's example is not a function. My code is almost the same.