[英]How can I store firebase user's uid in React?
I'm working on a react web application where users can sign up with an email and a password. 我正在开发一个React Web应用程序,用户可以在其中使用电子邮件和密码进行注册。 After signing up, each user will have access to their profile data.
注册后,每个用户都可以访问其个人资料数据。 Below is a my firebase data structure:
以下是我的Firebase数据结构:
users:{
generatedUserUID:{
name: "User1"
profileImage: "http://via.placeholder.com/350x150"
}
}
What would be the best way to store the user's uid when the user is signed in so that it can be used throughout the project. 用户登录后存储用户uid的最佳方法是什么,以便可以在整个项目中使用它。 Currently, I'm using the browser's localStorage, but I'm concerned that if the client browser doesn't support localStorage then the app will be rendered useless.
当前,我正在使用浏览器的localStorage,但我担心如果客户端浏览器不支持localStorage,则该应用将变得无用。 So, I'm looking for an alternative and not have to depend on localStorage entirely.
因此,我正在寻找一种替代方法,而不必完全依赖localStorage。 Any help is appreciated.
任何帮助表示赞赏。 Thank you.
谢谢。
You could use a library like Redux to manage data in your application. 您可以使用Redux之类的库来管理应用程序中的数据。 Redux helps you manage the state of your application.
Redux帮助您管理应用程序的状态。
More info here : http://redux.js.org/docs/basics/UsageWithReact.html 此处提供更多信息: http : //redux.js.org/docs/basics/UsageWithReact.html
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.