@getstation/use-firebase-auth
TypeScript icon, indicating that this package has built-in type declarations

2.0.5 • Public • Published

use-firebase-auth

Firebase authentication hook

NPM

Install

npm install --save use-firebase-auth
yarn add use-firebase-auth

Usage

Configure firebase application and pass it to the FirebaseAuthProvider. Wrap the parent component (your app component or any other parent component) with the provider, so that all the children component can share the auth information (user info, loading/error status, etc)

import React from "react"
import ReactDOM from "react-dom"
import App from "./components/app"
import { FirebaseAuthProvider } from "use-firebase-auth"
import firebase from "firebase/app"
import "firebase/auth"

const firebaseConfig = {
  //Load your Firebase Project configuration here
}
// Initialize Firebase
firebase.initializeApp(firebaseConfig)

ReactDOM.render(
  <FirebaseAuthProvider firebase={firebase}>
    <App />
  </FirebaseAuthProvider>,
  document.getElementById("root"),
)
import React, { Component } from "react"

import { useFirebaseAuth } from "use-firebase-auth"

const Example = () => {
  const { user, loading, error, signInWithProvider } = useFirebaseAuth()
  return <div>...</div>
}

Demo

Live demo

License

MIT © ulentini


This hook is created using create-react-hook.

Versions

Current Tags

VersionDownloads (Last 7 Days)Tag
2.0.54latest

Version History

VersionDownloads (Last 7 Days)Published
2.0.54
2.0.40
2.0.0-rc.00

Package Sidebar

Install

npm i @getstation/use-firebase-auth

Weekly Downloads

4

Version

2.0.5

License

MIT

Unpacked Size

1.45 MB

Total Files

38

Last publish

Collaborators

  • jeremy_vincent
  • v1s10n_4
  • matthd
  • nacryn
  • trapcodien
  • magne4000