React-redux: using connect as a decorator happenning a error!

Created on 13 Jan 2019  Â·  2Comments  Â·  Source: reduxjs/react-redux

×
You must pass a component to the function returned by connect. Instead received {"kind":"class","elements":[{"kind":"method","key":"render","placement":"prototype","descriptor":{"writable":true,"configurable":true,"enumerable":false}}]}
â–¶ 5 stack frames were collapsed.
Module../src/pages/login/Login.jsx
C:/Users/leese/Desktop/xiaoyuanwang/src/pages/login/Login.jsx:12
```
9 | const mapDispatchToProps = {};
10 |
11 | @connect(mapStateToProps, mapDispatchToProps)

12 | class Login extends React.Component {
13 | render() {
14 | console.log(this.props)
15 | return (

All 2 comments

We do not recommend using connect as a decorator, because the spec is unstable.

Also, this is a bug tracker, not a support system. For usage questions, please use Stack Overflow or Reactiflux where there are a lot more people ready to help you out - you'll probably get a better answer faster. Thanks!

We do not recommend using connect as a decorator, because the spec is unstable.

Also, this is a bug tracker, not a support system. For usage questions, please use Stack Overflow or Reactiflux where there are a lot more people ready to help you out - you'll probably get a better answer faster. Thanks!

decorator is better to read

Was this page helpful?
0 / 5 - 0 ratings