Created
December 7, 2016 00:28
-
-
Save guzmonne/b43a3f4f446b43cbe10e91086697c9d6 to your computer and use it in GitHub Desktop.
App component with Facebook component v1
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import React from 'react' | |
import Facebook from './modules/facebook.js' | |
class App extends React.Component { | |
constructor() { | |
super() | |
this.onLogin = this.onLogin.bind(this) | |
} | |
onLogin() { | |
Facebook() | |
.login() | |
.then(console.log) | |
.catch(() => console.log('User didn\'t sign in.')) | |
} | |
render() { | |
const {onLogin} = this | |
return ( | |
<div className="container"> | |
<button onClick={onLogin}>Sign in with Facebook</button> | |
</div> | |
) | |
} | |
} | |
export default App |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment