Using hello.js with React.js

I would like to understand how to make Hello.js work with React.js, especially the custom event handler hello.on

Since I am new to React.js, I don’t understand how to bind non-react events in the application thread.

I tried to put an event handler in a handler componentDidMount

    handleClick(){
    hello('twitter').login();
}

componentDidMount(){
    hello.on('auth.login', function(auth) {

    // Call user information, for the given network
        hello(auth.network).api('/me').then(function(r) {
            console.log(r);
        });
    });
    hello.init({
    'twitter' : 'J1jqqO50tcLtLx8Js0VDitjZW'
    },
    {
          redirect_uri:'/',
          oauth_proxy: 'https://auth-server.herokuapp.com/proxy'
    });

}

thank

+4
source share

Source: https://habr.com/ru/post/1598251/


All Articles