【问题标题】:How to clear redux store for React-admin?如何为 React-admin 清除 redux 存储?
【发布时间】:2022-01-05 11:19:55
【问题描述】:

我想在退出应用程序时清除 react admin redux 存储。 我该怎么做?

有没有办法访问 react admin 的 redux 存储,就像我必须访问具有所有潜在数据(如 userID、homeId 等)的资源仪表板。 当我在其他页面/资源上时,我需要将这些数据与另一个 API 请求的有效负载一起发送。我该怎么做?

【问题讨论】:

  • 请提供足够的代码,以便其他人更好地理解或重现问题。

标签: redux react-admin


【解决方案1】:

我认为这种方法更好。

const rootReducer = combineReducers({
    auth: authReducer,
    ...formReducers,
    routing
});


export default (state, action) =>
  rootReducer(action.type === 'USER_LOGOUT' ? undefined : state, action);

【讨论】:

  • 您的答案可以通过额外的支持信息得到改进。请edit 添加更多详细信息,例如引用或文档,以便其他人可以确认您的答案是正确的。你可以找到更多关于如何写好答案的信息in the help center
猜你喜欢
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 2022-12-07
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 2019-07-01
  • 2019-07-27
相关资源
最近更新 更多