没有 redux 的 Next.js 身份验证模式

发布于 2025-01-20 06:54:09 字数 154 浏览 1 评论 0原文

我有5个具有身份验证表格(登录,注册等)的模态对话框。几乎每种模态都可以从页脚和标头中调用。我的问题是我不知道如何构建我的代码,因此我不必将每个模态对话框状态传播到标题,页脚以及其他地方。最重要的是,每个新的模态对话框都必须关闭旧对话。我不想使用redux,因为现在不是那么大的应用程序。请帮忙

I have 5 modal dialogs with authentication forms (sign in, sign up, etc). Almost every modal can be called from footer and header. My problem is that i can't figure out how to structure my code so i don't have to propagate each modal dialog state from to header, footer and maybe somewhere else. On top of that each new modal dialog must close old one. I don't want to use redux because right now it's not that big of an app. Please help

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

嘿嘿嘿 2025-01-27 06:54:09

您可以使用上下文 api。它几乎与 redux 类似,但它是 React 内置的,所以你不需要安装任何其他包。您可以从下面的链接中了解这一点

Context Api

You can use context api. it is almost similar to redux but it is builtIn for React so you don't need to install any other packages. you can read about this from the below link

.Context Api

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文