3.0.0 • Published 2 years ago
use-firebase-auth v3.0.0
use-firebase-auth
Firebase authentication hook
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
License
MIT © ulentini
This hook is created using create-react-hook.
3.0.0
2 years ago
2.1.4
3 years ago
2.1.3
3 years ago
2.1.2
3 years ago
2.1.1
3 years ago
2.1.0
4 years ago
2.0.3
4 years ago
2.0.2
4 years ago
2.0.1
4 years ago
2.0.0
4 years ago
1.1.8
4 years ago
1.1.7
4 years ago
1.1.6
4 years ago
1.1.5
4 years ago
1.1.4
4 years ago
1.1.3
4 years ago
1.1.2
4 years ago
1.1.1
4 years ago
1.1.0
5 years ago
1.0.1
5 years ago
1.0.0
5 years ago