Closed m-ret closed 8 years ago
This is not really an alt specific question, but to answer your general question of getting the user ID in props, you can have the click function on your component call an alt action, which can make the async request to FB's API. The success response can call a success action that one of your stores can respond to and store the user ID. Then you can have your component listen to this store to get the user ID.
That said this Facebook login component might be work for your purposes as well.
Here are some general login resources with react:
I am trying to do a login with Facebook but I don't have any idea where to put the code that Facebook provides to me.
I made this same question in StackOverflow but nobody seems to know how, look:
http://stackoverflow.com/questions/34812562/facebook-login-using-reactjs
I am trying to figure out how to perform the Facebook login with React and make the userID part of the props in order to have the user available in the whole application.
Here is what I have
in the function
checkLoginState
the response comes with the status and the userID, that userID is the one I need to make available anywhere in the app, I guess I can achieve this using props, but according to my code, how do I put this userID into props ?EDIT
to give you a wider view of what I want: I have this code in the parent component of my app, then I have a header component where I have a sign in button, if the user is logged in, I have to hide that button and put the user name instead. So, according to what I have been reading about React, I need to pass the props from the parent component to the childs, like so:
What do you recommend me to do ?