Skip to content

Instantly share code, notes, and snippets.

React.useEffect(() => {
return auth().onAuthStateChanged((user) => {
if (user) {
setUser(user);
} else {
setUser(null);
}
});
}, []);
try {
await auth().signInWithPopup(provider);
const user = await auth().currentUser;
setUser(user);
} catch(e) {}
import React from 'react';
import { auth } from './firebase';
function Login() {
const login = async () => {
const provider = new auth.GoogleAuthProvider();
try {
await auth().signInWithPopup(provider);
} catch (e) {}
};
"emulators": "firebase emulators:start --import=data --export-on-exit",
// src/App.js
import React from 'react';
import { db } from './firebase';
function App() {
const [data, setData] = React.useState();
React.useEffect(() => {
db.doc('people/me')
.get()
// src/App.js
import React from "react";
import { db } from "./firebase";
function App() {
db.doc("hello/world").set({ hello: "world" });
return <div />;
}
export default App;
// src/firebase.js
import firebase from 'firebase/app';
import 'firebase/auth';
import 'firebase/firestore';
// TODO: Use a configuration object
firebaseApp.initializeApp({
projectId: '',
appId: '',
firebase-debug.log*
firestore-debug.log*
ui-debug.log*
language: objective-c
osx_image: xcode7.3
before_script:
- openssl aes-256-cbc -k $ENCRYPTION_PASSWORD -in fastlane/Certificates/distribution.p12.enc
-d -a -out fastlane/Certificates/distribution.p12
script:
- "./fastlane/travis.sh"