react-facebook
react-facebook copied to clipboard
How to do FB.api('me/accounts',function(response){ console.log('res',response); }); this with our package ?
How to do FB.api('me/accounts',function(response){ console.log('res',response); }); this with our package ?
New to this myself, but have been obsessing as of late. I was able to return information using the following:
const handleLoginResponse = function (res) {
window.FB.api("/me/accounts", function (result){
console.log(result)
});
}
The above method is attached to the onCompleted of the login component:
<Login scope="email" onCompleted={handleLoginResponse} onError={handleError}>
...
</Login>
UPDATED: Originally used lambda/arrow functions ( )=>{ } which causes a timing issue because it changes the scope.
@benbakle Thanks It's working now