reactjs - 在 react redux 项目中使用流
问题描述
在尝试将类型应用于连接功能时,我遇到了一些烦人的问题。我不确定,流程是否正确实施。我将相同的实现应用于 2 个单独的 JS 文件,一个还可以,但另一个不断引发这样的错误
1. all branches are incompatible: Either null [1] is incompatible with function type [2]. Or null [1] is incompatible with function type [3].Flow(InferError)
2. a call signature declaring the expected parameter / return type is missing in `ReduxDispatchProps` [1] but exists in function type [2] in the return value.Flow(InferError)
顺便说一句,这是我的实现。
interface ReactProps {
user?: User;
asset?: Asset;
autoUpdate?: boolean;
std_time?: number;
handleOpenModalUpdateStandardTime?: (standardTime: StandardTime) => void;
}
interface ReduxStateProps {}
interface ReduxDispatchProps {
updateEntityStandardTime: UpdateEntityStandardTimeHandler;
}
interface IProps extends ReduxStateProps, ReactProps, ReduxDispatchProps {}
class ComponentA extends Component<IProps,{}> {}
const mapDispatchToProps = (dispatch): ReduxDispatchProps => {
return {
updateEntityStandardTime: (payload: StandardTime, callback: ?Callback) =>
dispatch(updateEntityStandardTimeRequest(payload, callback)),
};
};
export default connect<IProps, ReactProps, _, _, _, _>(
null,
mapDispatchToProps
)(ComponentA);
期待你们的帮助!
解决方案
推荐阅读
- git - 命令告诉 git 不要跟踪某些文件
- distributed - 分布式系统 VS 集中式系统的安全性
- google-apps-script - 我想在我的日期时间行中获得编辑时间戳,但是当我在谷歌脚本中复制/粘贴多行时,我还需要它来时间戳
- python - CSGO Market API 400 错误请求
- javascript - Why is Data not being passed through my Node REST API?
- regex - 使用 htaccess 将特定字符 URL 后的第一个字母转换为大写
- c# - gRPC .NET 5 / C# 项目中的模糊路由异常
- javascript - 使用 3 个已知点在 2 个 3D 笛卡尔坐标系之间进行转换
- excel - VBA - 如何在一张纸中设置多页的打印区域?
- featuretools - 指定原始选项的 Featuretools 文档是错误的?