我正在使用eslint-plugin-immutable
,所以我不能使用this
关键字(我可以使用 eslint-disable-line,但我不想),所以我想知道是否有任何方法recompose
可以访问任何挂载生命周期中的道具, 不使用this
关键字。
const enhance = compose(
lifecycle({
componentWillMount() {
const { props } = this // throws eslint error
console.log(this.props); // works, throws eslint error
},
}),
);