diff --git a/packages/taro-redux/package.json b/packages/taro-redux/package.json index b1041d7a8de6..e465fc5a1119 100644 --- a/packages/taro-redux/package.json +++ b/packages/taro-redux/package.json @@ -6,6 +6,7 @@ "typings": "types/index.d.ts", "scripts": { "test": "jest", + "dev": "rollup -c rollup.config.js -w", "build": "rollup -c rollup.config.js" }, "files": [ diff --git a/packages/taro-redux/src/connect/connect.js b/packages/taro-redux/src/connect/connect.js index ea12fcc3b61a..f4b7a14dd28b 100644 --- a/packages/taro-redux/src/connect/connect.js +++ b/packages/taro-redux/src/connect/connect.js @@ -65,12 +65,12 @@ export default function connect (mapStateToProps, mapDispatchToProps) { }) } - componentWillMount () { + _constructor () { const store = getStore() Object.assign(this.props, mergeObjects(mapStateToProps(store.getState(), this.props), initMapDispatch)) unSubscribe = store.subscribe(stateListener.bind(this)) - if (super.componentWillMount) { - super.componentWillMount() + if (super._constructor) { + super._constructor(this.props) } }