Skip to content

Instantly share code, notes, and snippets.

@guzmonne
Created December 7, 2016 00:28
Show Gist options
  • Save guzmonne/b43a3f4f446b43cbe10e91086697c9d6 to your computer and use it in GitHub Desktop.
Save guzmonne/b43a3f4f446b43cbe10e91086697c9d6 to your computer and use it in GitHub Desktop.
App component with Facebook component v1
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