【发布时间】:2019-09-30 21:21:24
【问题描述】:
我正在使用 Redux 和 Typescript 编写一个 React Native 应用程序。我一直在看其他人的代码(我不能逐字分享),当他们使用connect 函数时,它看起来像这样:
export default connect<a, b, c, d>(
state => ({
...
}),
dispatch => bindActionCreators({
...
}, dispatch)
)(<Component name>)
谁能解释a, b, c, d 参数的用途是什么?我知道这涉及 Typescript 泛型,但谁能让我更深入地了解 connect 如何使用这些?
谢谢!
【问题讨论】:
标签: reactjs typescript react-native redux react-redux