为什么 mapStateToProps 有 Eslint 警告 'Functions that return promises must be async'?
Why mapStateToProps has Eslint warning 'Functions that return promises must be async'?
我收到 Eslint 警告:
Functions that return promises must be async.
eslint(@typescript-eslint/promise-function-async)
函数中:
import { getFormValues, change } from 'redux-form';
function mapStateToProps(state: any, ownProps: IWizardPageProps) {
const stateProps = getFormValues('wizard')(state);
return {
...ownProps,
...stateProps,
change,
};
}
我不明白哪里出了问题。我在那里看不到任何承诺。
redux-form 本身依赖于 promise 调用。所以返回 change 或 getFormValues 将使它成为返回函数的承诺。
我收到 Eslint 警告:
Functions that return promises must be async.
eslint(@typescript-eslint/promise-function-async)
函数中:
import { getFormValues, change } from 'redux-form';
function mapStateToProps(state: any, ownProps: IWizardPageProps) {
const stateProps = getFormValues('wizard')(state);
return {
...ownProps,
...stateProps,
change,
};
}
我不明白哪里出了问题。我在那里看不到任何承诺。
redux-form 本身依赖于 promise 调用。所以返回 change 或 getFormValues 将使它成为返回函数的承诺。