import React from 'react';
import firebase from 'firebase';

export default () => {
  const handleSignIn = async () => {
    const provider = new firebase.auth.GoogleAuthProvider();
    try {
      await firebase.auth().signInWithPopup(provider);
    } catch (error) {
      console.error(error);
      alert('failed to sign in.')
    }
  }
  
  return (
    <button onClick={handleSignIn}> Sign in with Google </button>
  );
}

import React from 'react';
import firebase from 'firebase';

export default class SignIn extends React.Component {
  async handleSignIn() {
    const provider = new firebase.auth.GoogleAuthProvider();
    try {
      await firebase.auth().signInWithPopup(provider);
    } catch (error) {
      console.error(error);
      alert('failed to sign in.')
    }
  }
  
  render() {
    return (
      <button onClick={this.handleSignIn.bind(this)}> Sign in with Google </button>
    );
  }
}

Revert "refactor sign in button"
Revert "refactor sign in button"

This reverts commit 6dea656fdfb1f895256ebec911602e5c3d5ef88e.
