Reputation: 680
Please forgive me if my question seems ridiculous but I'm new to ReactJs.
I have a react component that reflects the user's sign In status:
<AccountStatus iconsize="medium" activate={[true,false,true]}/>
//or using
<AccountStatus iconsize="medium" activate={true}/>
I handle the application logic separately in another (non-react) js file which is loaded alongside other scripts when the page is loaded:
<script src="/assets/js/logic.js" type="text/javascript"></script>
In this last file I handle the user authentication and update the global variables accordingly. I'd like to be able to modify the state of the component based on the changes that occur in these global variables.
var user, credential, token;
var providers = {
facebook.com: true,
twitter.com: false,
google.com: true,
};
Upvotes: 0
Views: 105
Reputation: 3298
I think you should be approaching your requirement in a different directions.
So check for the authentication here. This should be a fairly simple way to authenticate the user.
In this last file I handle the user authentication and update the global variables accordingly. I'd like to be able to modify the state of the component based on the changes that occur in these global variables.
This statement by you forces me to think you will need to have redux for global state management.
I know this will be a tough thing to wrap your mind around, but this would be the right approach!
Upvotes: 4