Watts Kendall

Watts Kendall


How to Build a Reusable React Login Component

Learn how to build a reusable and shareable Firebase Google login component

In this chapter, we will continue from where we left off in the first chapter that dealt with implementing a Facebook login and initiating a react app structure. We are going to add Google login to the same app we created in the first chapter. This chapter is short, sweet, and simple because we have already completed the problematic section in the previous chapter. We have broken down this tutorial into various sub-headings for you to grasp the concept about React project, Google login, firebase auth, component implementation, etc. and work accordingly.

Now, let’s get on with implementing the Google login!

What you’ll learn …?

  • How to create a new React app.
  • How to pass props in React.
  • How to use Firebase Authentication.
  • How to create and set up a Google app.
  • How to use Bit.

Most of the points have already been covered in the first chapter, so this chapter makes the concepts even clearer as we move along.


As we have done most of the problematic section in the first chapter, this chapter only tackles the issue of implementation of Google login; which is relatively simple compared to Facebook login. So, we need a quick win here without wasting much of our time. We need to generate result quickly, which is an important part that keeps us motivated to reach our end milestones.


Here’s a complete list of plugins, packages, and services we’re going to need to gain something from this tutorial:

  • Nodejs v8.x.x or higher installed along with NPM/yarn.
  • Firebase and Bit account.
  • You’ve already completed the project from the previous chapter.
  • Firebase and Bit package.

Reusable previous code

To make things easier for us, we are going to replicate the Facebook component that we created in the first chapter and change all related names to Google. The project directory structure will look something like below:

The places where we changed the name from Facebook to Google are mentioned in detail below:

  1. Folder FacebookAuth is changed to GoogleAuth.
  2. FacebookAuth.jsx file is changed to GoogleAuth.jsx file.
  3. In GoogleAuth.jsx file, change the class name to GoogleAuth.
  4. In handleLogin() function, change the FacebookAuthProvider to GoogleAuthProvider.

Then, we need to change Facebook to Google in the HTML section as given below in the following code snippet:

<li class="firebaseui-list-item">
        class="firebaseui-idp-button mdl-button mdl-js-button mdl-button--raised firebaseui-idp- **google** firebaseui-id-idp-button">
         <span class="firebaseui-idp-icon-wrapper">

           <img class="firebaseui-idp-icon" alt="" src="https://www.gstatic.com/firebasejs/ui/2.0.0/images/auth/ **google**.svg">
          <span class="firebaseui-idp-text firebaseui-idp-text-long">
              Sign in with **Google**
          <span class="firebaseui-idp-text firebaseui-idp-text-short">

The above code will provide us with the Google login component which we need to import in our App.js file.

Now, we need to copy the code below and add it to our App.js file.

In our GoogleAuth/index.js file, we need to replace all the import of FacebookAuth with GoogleAuth, as shown in the code snippet below:

Now, every change will be made only in our App.js file. We need to change the App.js file to include the component and pass firebase configuration as shown in the code snippet below:

As a result, we will see the following result in our browser screen or app screen:

We can see that this is working fine. Now, we move one to Firebase part of our tutorial chapter.

Activating the Sign-in method in Firebase

In this step, we need to activate the Sign-in method in our firebase console for Google login to work. For that, we need to:

Go to firebase console > Authentication > enable Google Sign-in Method

Lastly, we need to provide a project support email and then click on “save” button as shown in the console screenshot below:

After this is done, we need to return to our app and click on Google Login. We will see the following simulation and result in our browser console:

Finally, we have successfully implemented Google login as well in our react app.

Now, we need to push the code to Bit as in the previous chapter by creating a new collection.

Make it Reusable and Sharable with Bit

To make our code reusable and shareable, we’ll do some restructuring and move all our code to ‘components’ (this is not mandatory but a better practice, when using Bit). Then, we’ll export it (with all its dependencies), to a component collection on Bit’s cloud, to be shared with others and easily reused.

In this step, we are going to push the new component i.e. Google login component to Bit again. We already have our Bit package installed and connected to our Bit account. So, we need to create a collection and start by tracking the component.

Note: The first and second step features an installation of Bit account. These steps can be skipped if you already have a Bit account.

1. Create a collection and initialize Bit on a project

Here, we create a new collection on Bit to which we are going to push all our component code. We use the Bit “create collection” configuration page to create a new collection named “firebase-auth-collection” as shown in the screenshot below:

To successfully push the whole project to Bit, you need to follow the instructions given on the page shown below:

First, we need to install Bit CLI

Using NPM,> npm install bit-bin --global
Then, we need to go to the project directory in our Bit CLI and perform the commands bit init and run bit login on Bit CLI as shown in the screenshot below:

2. Configure a React compiler for our component

When we configure a compiler we tell Bit to capsule the component with it. Capsuling components together with their compilers gives us the freedom to use, build and test them anywhere. This includes being able to run the code in any of the applications we’d like to use the component in, as well as running it in the cloud to enable features such as the live component playground.

bit import bit.envs/compilers/react --compiler

3. Track components

We need to track our component by using the following command in your command prompt or Bit console:

bit add src/components/GoogleAuth

The result after the command is performed is shown below in the screenshot:

4. Tag and export to our collection on Bit’s cloud

Here, we are going to set a version to all tracked components, and export to this collection using following bit command:

bit tag --all 1.0.0

Finally, we need to perform following bit command to push our component code to bit collection that we created before:

bit export krissnawat.firebase-auth-collection

Now, our package is live on Bit. It is our second component in our firebase auth collection as shown in the screenshot below:

Lastly, we need to replace the component in our App.js file as shown in the code snippet below:

import React, { Component } from "react";
	// import "./App.css";
	import "./index.css";
	import FacebookAuth from "@bit/krissnawat.firebase-auth-collection.facebook-auth";
	import GoogleAuth from "./components/GoogleAuth";

	const firebaseConfig = {
	  apiKey: "xxxxxxxx",
	  authDomain: "xxxxxx.firebaseapp.com",
	  databaseURL: "https://xxxxxxx.firebaseio.com",
	  projectId: "xxxxxxx",
	  storageBucket: "xxxxxxx.appspot.com",
	  messagingSenderId: "xxxxxxx",
	  appId: "1:140177169073:web:xxxxxxx"
	class App extends Component {
	  render() {
	    return (
	      <div className="App">
	        <FacebookAuth firebaseConfig={firebaseConfig} />
	        <GoogleAuth firebaseConfig={firebaseConfig} />

	export default App;

Finally, the implementation of Google login with firebase auth and uploading the component to Bit is complete. Now, we can run the project locally to test everything.


In this tutorial, we learned how to implement Google login with firebase. We also learned about implementing the re-usable code in the form of components as in the previous chapter. Finally, we were successful in pushing our second component in our Firebase Auth collection.

Thanks for reading. If you liked this post, share it with all of your programming buddies!

Further reading

Understanding TypeScript

Typescript Masterclass & FREE E-Book

React - The Complete Guide (incl Hooks, React Router, Redux)

Modern React with Redux [2019 Update]

The Complete React Developer Course (w/ Hooks and Redux)

React JS Web Development - The Essentials Bootcamp

React JS, Angular & Vue JS - Quickstart & Comparison

The Complete React Js & Redux Course - Build Modern Web Apps

React JS and Redux Bootcamp - Master React Web Development

Using React-Router to Optimize Single Page Applications

#reactjs #react-native #javascript #web-development

What is GEEK

Buddha Community

How to Build a Reusable React Login Component
Autumn  Blick

Autumn Blick


How native is React Native? | React Native vs Native App Development

If you are undertaking a mobile app development for your start-up or enterprise, you are likely wondering whether to use React Native. As a popular development framework, React Native helps you to develop near-native mobile apps. However, you are probably also wondering how close you can get to a native app by using React Native. How native is React Native?

In the article, we discuss the similarities between native mobile development and development using React Native. We also touch upon where they differ and how to bridge the gaps. Read on.

A brief introduction to React Native

Let’s briefly set the context first. We will briefly touch upon what React Native is and how it differs from earlier hybrid frameworks.

React Native is a popular JavaScript framework that Facebook has created. You can use this open-source framework to code natively rendering Android and iOS mobile apps. You can use it to develop web apps too.

Facebook has developed React Native based on React, its JavaScript library. The first release of React Native came in March 2015. At the time of writing this article, the latest stable release of React Native is 0.62.0, and it was released in March 2020.

Although relatively new, React Native has acquired a high degree of popularity. The “Stack Overflow Developer Survey 2019” report identifies it as the 8th most loved framework. Facebook, Walmart, and Bloomberg are some of the top companies that use React Native.

The popularity of React Native comes from its advantages. Some of its advantages are as follows:

  • Performance: It delivers optimal performance.
  • Cross-platform development: You can develop both Android and iOS apps with it. The reuse of code expedites development and reduces costs.
  • UI design: React Native enables you to design simple and responsive UI for your mobile app.
  • 3rd party plugins: This framework supports 3rd party plugins.
  • Developer community: A vibrant community of developers support React Native.

Why React Native is fundamentally different from earlier hybrid frameworks

Are you wondering whether React Native is just another of those hybrid frameworks like Ionic or Cordova? It’s not! React Native is fundamentally different from these earlier hybrid frameworks.

React Native is very close to native. Consider the following aspects as described on the React Native website:

  • Access to many native platforms features: The primitives of React Native render to native platform UI. This means that your React Native app will use many native platform APIs as native apps would do.
  • Near-native user experience: React Native provides several native components, and these are platform agnostic.
  • The ease of accessing native APIs: React Native uses a declarative UI paradigm. This enables React Native to interact easily with native platform APIs since React Native wraps existing native code.

Due to these factors, React Native offers many more advantages compared to those earlier hybrid frameworks. We now review them.

#android app #frontend #ios app #mobile app development #benefits of react native #is react native good for mobile app development #native vs #pros and cons of react native #react mobile development #react native development #react native experience #react native framework #react native ios vs android #react native pros and cons #react native vs android #react native vs native #react native vs native performance #react vs native #why react native #why use react native

I am Developer


React Google Login Example

Integrate google login in react apps; This example tutorial will show you step by step how to implement google login in react apps using javascript SDK.

If you want to integrate google login authentication in your react app. So you will not need any react plugin for this. In this tutorial, you will learn how to add a google login button in react app without any react plugin.

Before you can integrate Google Sign-In into your react app, you must create a client ID, which you need to call the sign-in API.

To create a Google API Console project and client ID, go to the APIs & Services dashboard and then follow the following steps:

Step 1: Visit Google Developer Console. And create a new project as following in below picture:

Step 2: you will see the screen looks like, show here you can set your project name as you want.

Step 3: Now you have successfully created a new project. After that, you need to select the created projects on the top menu. Then click on OAuth consent screen and select the given option according to your requirement:

Step 4: when you will be done above. After that automatically appear below given screen. In this screen, you need to fill your website URL, privacy policy URL, etc.

Step 5: you need to click on left side menu credentials and appear below screen. In this screen, you need to select OAuth client ID.

Step 6: After that, the below form will be apper. Here From different Application type options, you have to select Web application. Once you have select Web application option, then one form will appear on web page. Here you have to define Name and you have also define Authorized redirect URIs field and lastly click on Create button.

Step 7: the pop looks like below in picture automatically appear. Once you have click on the create button, then you can get your Client ID and your client secret key. You have to copy both key for future use for implement Login using Google account using PHP.

Please note that, google client id and secret.

How to Add Google Login to your React Apps

  • Step 1 - Create React App
  • Step 2 - Install Bootstrap 4 Library
  • Step 3 - Create Google Login Component
  • Step 4 - Import Google Login Component in App.js


#react-google-login component #react-google-login demo #google login with react #add google login button to react

Franz  Becker

Franz Becker


React Starter Kit: Build Web Apps with React, Relay and GraphQL.

React Starter Kit — "isomorphic" web app boilerplate   

React Starter Kit is an opinionated boilerplate for web development built on top of Node.js, Express, GraphQL and React, containing modern web development tools such as Webpack, Babel and Browsersync. Helping you to stay productive following the best practices. A solid starting point for both professionals and newcomers to the industry.

See getting started guide, demo, docs, roadmap  |  Join #react-starter-kit chat room on Gitter  |  Visit our sponsors:



Getting Started


The master branch of React Starter Kit doesn't include a Flux implementation or any other advanced integrations. Nevertheless, we have some integrations available to you in feature branches that you can use either as a reference or merge into your project:

You can see status of most reasonable merge combination as PRs labeled as TRACKING

If you think that any of these features should be on master, or vice versa, some features should removed from the master branch, please let us know. We love your feedback!



React Starter Kit

React Static Boilerplate

ASP.NET Core Starter Kit

App typeIsomorphic (universal)Single-page applicationSingle-page application
LanguageJavaScript (ES2015+, JSX)JavaScript (ES2015+, JSX)JavaScript (ES2015+, JSX)
LibrariesReact, History, Universal RouterReact, History, ReduxReact, History, Redux
RoutesImperative (functional)DeclarativeDeclarative, cross-stack
LanguageJavaScript (ES2015+, JSX)n/aC#, F#
LibrariesNode.js, Express, Sequelize,
n/aASP.NET Core, EF Core,
ASP.NET Identity
Data APIGraphQLn/aWeb API


♥ React Starter Kit? Help us keep it alive by donating funds to cover project expenses via OpenCollective or Bountysource!

lehneres Tarkan Anlar Morten Olsen Adam David Ernst Zane Hitchcox  

How to Contribute

Anyone and everyone is welcome to contribute to this project. The best way to start is by checking our open issues, submit a new issue or feature request, participate in discussions, upvote or downvote the issues you like or dislike, send pull requests.

Learn More

Related Projects

  • GraphQL Starter Kit — Boilerplate for building data APIs with Node.js, JavaScript (via Babel) and GraphQL
  • Membership Database — SQL schema boilerplate for user accounts, profiles, roles, and auth claims
  • Babel Starter Kit — Boilerplate for authoring JavaScript/React.js libraries



Copyright © 2014-present Kriasoft, LLC. This source code is licensed under the MIT license found in the LICENSE.txt file. The documentation to the project is licensed under the CC BY-SA 4.0 license.

Author: kriasoft
Source Code: https://github.com/kriasoft/react-starter-kit
License: MIT License

#graphql #react 

Create Password Protected Webpage Using PHP, HTML And CSS

In this tutorial we will show you how to create password protected webpage using PHP, HTML and CSS.
In this user have to write correct password to see the webpage content without password user will not be able to see the webpage content.

To Create Password Protected webpage It Takes Only Two Steps:-

  1. Make a PHP file and define markup
  2. Make a CSS file and define styling

Step 1. Make a PHP file and define markup

We make a PHP file and save it with a name password.php


if(isset($_POST['submit_pass']) && $_POST['pass'])
  $error="Incorrect Pssword";


<link rel="stylesheet" type="text/css" href="password_style.css">
<div id="wrapper">

 <h1>Create Password Protected Webpage Using PHP, HTML And CSS</h1>
 <form method="post" action="" id="logout_form">
  <input type="submit" name="page_logout" value="LOGOUT">
 <form method="post" action="" id="login_form">
  <input type="password" name="pass" placeholder="*******">
  <input type="submit" name="submit_pass" value="DO SUBMIT">
  <p>"Password : 123"</p>
  <p><font style="color:red;"><?php echo $error;?></font></p>


In this step we first check if user logged in or not by checking session variable if the user is not logged in we display login form and if user is logged in we display webpage content with logout button.

We use two isset() condition to do login or logout.In first condition we simply get the password and check if the password is '123' if yes we put the password in session variable and then display the webpage.

In second condition we simply unset the session variable which stores password value. You may also like simple http authentication using PHP .

Step 2. Make a CSS file and define styling

We make a CSS file and save it with a name password_style.css

 margin:0 auto;
 font-family: "Myriad Pro","Helvetica Neue",Helvetica,Arial,Sans-Serif;
 margin:0 auto;
#wrapper h1
#wrapper p
#logout_form input[type="submit"]
 border:2px solid white;
 box-shadow:0px 0px 10px 0px #3B240B;
#login_form h1
#login_form input[type="password"]
#login_form input[type="submit"]
 box-shadow:0px 4px 0px 0px #61380B;
#login_form p
Aubrey  Price

Aubrey Price


Build a simple React Native Pokemon app with React-Navigation

As we start learning new technologies we want to start building something or work on a simple project to get a better understanding of the technology. So, let’s build this simple app.
For this app, we will be using PokeApi to get our pokemon data, and also we will be using Hooks. I am using pokemondb for pokemon sprites. It’s just a personal preference you can use whatever you want.

#react-native #react-native-app #react-navigation #react-native-development #react