【问题标题】:Is it possible to wrap next-auth Provider within redux Provider?是否可以将 next-auth Provider 包装在 redux Provider 中?
【发布时间】:2021-04-01 11:01:35
【问题描述】:

如果我已经在我的 next.js 应用程序中使用了 next-auth,我可以在 _app.js 中以某种方式在它周围添加 redux 吗?

我尝试的是这样的:

import React from "react"
import { Provider } from 'next-auth/client'
import {Provider as ReduxProvider} from 'react-redux';
import {configureStore} from './store/configureStore';
import '../public/styles.css'

const store = configureStore();

export default function App ({ Component, pageProps }) {
  return (
    <ReduxProvider store={store}>
      <Provider
        // next-auth params, etc.

这是正确的吗?它是这样工作的吗? 我还需要使用 redux-saga,对整个事情来说都是新的,所以我还处于设置阶段

【问题讨论】:

标签: reactjs redux next.js redux-saga next-auth


【解决方案1】:

答案是肯定的。你可以这样做。我自己试过了,效果很好。

【讨论】:

    猜你喜欢
    • 2021-05-23
    • 2021-11-26
    • 2021-10-22
    • 2022-12-17
    • 2017-02-14
    • 2021-12-24
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多