课程: React: Creating and Hosting a Full-Stack Site (2022)
今天就学习课程吧!
今天就开通帐号,24,700 门业界名师课程任您挑!
Creating a custom auth hook
- [Instructor] All right, so now that users can log into our application through the login page. The next thing that we're going to need to do is modify our article page so that it can adjust based on whether a user is logged in or not. Now, to give you an idea of what this is going to look like, inside our article page, remember that we're displaying both this Upvote section which allows a user to up vote an article, and we're also displaying this AddCommentForm. Now, we're only going to want to display both of those if the user is logged in. Because we're only going to want users to be able to up vote articles once. And we're only going to want users to be able to add comments if they're logged in. All right, so basically what we're going to need in this article page component, is a way to know at any given moment whether the user is logged in or not. And that's where this useUser custom hook comes in. So what this…
内容
-
-
-
-
-
-
-
Why Firebase Auth?1 分钟 17 秒
-
(已锁定)
Creating a Firebase project4 分钟 16 秒
-
(已锁定)
Adding Firebase Auth to React9 分钟 27 秒
-
(已锁定)
Build a login form11 分钟 56 秒
-
(已锁定)
Creating a custom auth hook8 分钟 52 秒
-
(已锁定)
Build a create-account page7 分钟 59 秒
-
(已锁定)
Adding Firebase Auth to Node.js6 分钟 25 秒
-
(已锁定)
Protecting endpoints using auth-tokens8 分钟 44 秒
-
(已锁定)
Protecting the upvote and comment endpoints4 分钟 47 秒
-
(已锁定)
Making requests with auth tokens6 分钟 41 秒
-
(已锁定)
Making interface adjustments for authenticated users6 分钟 34 秒
-
-
-