[英]Why mapStateToProps has Eslint warning 'Functions that return promises must be async'?
I got Eslint warnings: 我收到了Eslint警告:
Functions that return promises must be async.
eslint(@typescript-eslint/promise-function-async)
On function: 开启功能:
import { getFormValues, change } from 'redux-form';
function mapStateToProps(state: any, ownProps: IWizardPageProps) {
const stateProps = getFormValues('wizard')(state);
return {
...ownProps,
...stateProps,
change,
};
}
I don't understand what is wrong. 我不明白怎么了。 I don't see any promise there.
我在那里看不到任何承诺。
The redux-form itself relies on the promise call. redux表单本身依赖于promise调用。 So returning change or getFormValues will make it a promise returning functions.
因此,返回change或getFormValues将使其成为一个承诺返回函数。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.