redux - 如何在 React 类组件中使用 Redux 与多个 React 提供程序连接?
问题描述
在使用 Redux 的 React 组件中,除了 Redux connect() 之外,我还想使用 withCookies 和 withAuth0 提供程序。
import { withCookies } from 'react-cookie';
import { withAuth0 } from '@auth0/auth0-react';
class TopBarRedux extends React.Component<any, any>{
...
export const TopBar = withCookies(
withAuth0(
connect(
mapStateToProps,
mapDispatchToProps,
)(TopBarRedux)
)
)
但是,当使用该组件时
<TopBar />
componentDidMount() 被调用,但 componentDidUpdate() 从未被调用。export const 的语法或顺序是否不正确?
解决方案
推荐阅读
- java - LOGBACK : 如何使用 JSONLayout 记录整个 msg
- c# - 内容仅在给定时间显示在单个元素中
- sql - 如何制作这个查询的临时表?(多个连接)
- xpath - 如何在 pmd 中编写 xpath 规则以识别第三方 jar 的已弃用 api
- python - 如何在 IPython 中为自定义类的实例启用特定的选项卡完成功能?
- python - 获取共享相同列表值及其公共值的所有字典键的字典
- ruby-on-rails - 将 sqlite 更改为 pg
- excel - 我的代码在保存文件名中包含日期和时间的文件时显示错误消息
- .net-core - 如何通过管道 UI 将自包含的 dotnet 核心包发布到 azure 工件?
- aws-lambda - 从 kinesis 数据流触发 lambda