我使用 react hooks 来更新,但是在 setState 时会注意到错误。
'{ alertRules: any; 类型的参数 }' 不能分配给'SetStateAction' 类型的参数。对象字面量只能指定已知属性,并且类型“SetStateAction”中不存在“alertRules”.ts(2345)
这是我的代码。
import React, { useState, useEffect } from 'react';
import { FieldArray } from 'redux-form';
import { CoordinateSelect } from '~/fields';
import lodash from 'lodash';
import { connect } from 'react-redux';
import { filterDispatchers } from '~/actions';
import t from '~/locale';
interface Props {
getAlertRules(o: object): Promise<any>;
}
type Alert = {
...
}
const connector = connect(
null,
filterDispatchers('getAlertRules'),
);
const AlertRuleForm = (props: Props) => …Run Code Online (Sandbox Code Playgroud)