React for Beginners by D. Truman Neo
Author:D. Truman, Neo
Language: eng
Format: epub
Published: 2022-05-16T00:00:00+00:00
export default Navigation;
Please do the following steps to test our code:
â Run the application again. At this time, we only see the âLog Inâ link. The âLogoutâ link is hidden because currentUser is null.
â Go to the Login page.
â Click the âGoogle Sign Inâ button.
â Select a Google account and sign in with that account.
â After logging in with Google account successfully, we only see the âLogoutâ link. The âLog Inâ link is hidden because currentUser is not null.
â Finally, click the âLogoutâ link. At this time, we only see the âLog Inâ link and you know why.
The current code is not good enough. Try these steps to see:
â Run the application again.
â Go to the Login page.
â Click the âGoogle Sign Inâ button.
â Select a Google account and sign in with that account.
â After logging in with Google account successfully, refresh the web page and you see the âLog Inâ link. This is not what we expect because we just logged in recently.
Letâs fix this issue using onAuthStateChanged of firebase/auth.
/src/utils/firebase.utils.js
import { initializeApp } from "firebase/app";
import {
getAuth,
signInWithPopup,
signOut,
GoogleAuthProvider,
onAuthStateChanged
} from 'firebase/auth';
Download
This site does not store any files on its server. We only index and link to content provided by other sites. Please contact the content providers to delete copyright contents if any and email us, we'll remove relevant links or contents immediately.
Building Blazor WebAssembly Applications with gRPC by Václav Pekárek(3701)
Hands-On Application Development with PyCharm by Bruce M. Van Horn II Quan Nguyen(2192)
Designing Web APIs with Strapi: Get started with the Strapi headless CMS by building a complete learning management system API by Khalid Elshafie Mozafar Haider(1051)
Django 4 for the Impatient. Learn the core concepts of Python web development with Django in one weekend by G. Lim D. Correa(909)
Vue.js 3 Design Patterns and Best Practices by Pablo David Garaguso(848)
Accelerating Server-Side Development with Fastify by Manuel Spigolon & Maksim Sinik & Matteo Collina(848)
Drupal 10 Module Development - Fourth Edition by Daniel Sipos(766)
Mastering CSS Grid by Thormeier Pascal;(727)
Going the Distance with Babylon.js: Building extensible, maintainable, and attractive browser-based interactive applications using JavaScript by Josh Elster(697)
Simplifying State Management in React Native by Aleksandra Desmurs-Linczewska(617)
Java Memory Management by Maaike van Putten & Seán Kennedy(546)
Hands-On Application Development with Pycharm by II Bruce M. Van Horn;Nguyen Quan;(529)
Joomla!® Explained: Your Step-by-Step Guide (Joanne Romanovich's Library) by Stephen Burge(323)
Python & JavaScript Mastery: 2 Books In 1- Learn And Master Two Powerful Programming Languages by Alex iversion(309)
Beginning Modern JavaScript: A Step-By-Step Gentle Guide to Learn JavaScript for Beginners (Code With Nathan) by Sebhastian Nathan(261)
Understanding JavaScript Promises by Nicholas C. Zakas(248)
Create GUI Applications with Python & Qt6: The hands-on guide to making apps with Python by Martin Fitzpatrick(246)
Programming With Java by Edet Theophilus(245)
NextJS 13 and React Crash Course: Build a Full Stack NextJS 13 App with React, Tailwind and Prisma backend by Lim Greg(231)
