Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

react-social-login breaks when used with create-react-app v3.0.0 #137

Open
yuchuan1 opened this issue May 3, 2019 · 14 comments
Open

react-social-login breaks when used with create-react-app v3.0.0 #137

yuchuan1 opened this issue May 3, 2019 · 14 comments

Comments

@yuchuan1
Copy link

yuchuan1 commented May 3, 2019

Sample repo
Steps to reproduce.

  1. npx create-react-app test-app
  2. cd test-app
  3. yarn add react-social-login
  4. add SocialButton.js as stated in Usage
  5. replace index.js with the index.js stated in Usage
  6. replace app with root in index.js
  7. yarn start

in Chrome, it shows error messages as following.

TypeError: Cannot read property 'render' of undefined
new n
node_modules/react-social-login/dist/social-login.js:4083
4080 | function n(e) {
  4081 |   i(this, n);
  4082 |   var r = o(this, (n.__proto__ || Object.getPrototypeOf(n)).call(this, e));
> 4083 |   return r.isStateless = !t.prototype.render, r.state = {
       | ^  4084 |     isLoaded: !1,
  4085 |     isConnected: !1,
  4086 |     isFetching: !1

in Firefox, the error message is as following.

TypeError: t.prototype is undefined
n
node_modules/react-social-login/dist/social-login.js:4083
 4080 | function n(e) {
  4081 |   i(this, n);
  4082 |   var r = o(this, (n.__proto__ || Object.getPrototypeOf(n)).call(this, e));
> 4083 |   return r.isStateless = !t.prototype.render, r.state = {
       | ^  4084 |     isLoaded: !1,
  4085 |     isConnected: !1,
  4086 |     isFetching: !1
@jangsi
Copy link

jangsi commented May 11, 2019

I get the same error with the example code. When I convert the example button from using a stateless component to extending React.Component, it works.

@yuchuan1
Copy link
Author

I need to be able to use react hooks.

@devapurva
Copy link

@yuchuan1 hey did you get solution to this? I am facing the same issue.

@yuchuan1
Copy link
Author

yuchuan1 commented Jul 1, 2019

@devapurva
Since my new project only requires fb and google, I moved away from using this module.

@towfiqi
Copy link

towfiqi commented Jul 4, 2019

So basically its broken.. :/

@yuchuan1
Copy link
Author

yuchuan1 commented Jul 4, 2019

@towfiqi
Someone gotta dig into the code and figure out a solution

@VimLeSai
Copy link

VimLeSai commented Jul 6, 2019

@yuchuan1, @jangsi so basically it's brokes when you use React Hooks or Functional Component, is that what happens?

@towfiqi
Copy link

towfiqi commented Jul 6, 2019

It doesn't work with class components too.

@VimLeSai
Copy link

VimLeSai commented Jul 6, 2019

@towfiqi okay

@xzessmedia
Copy link

xzessmedia commented Oct 12, 2019

I get the same error with the example code. When I convert the example button from using a stateless component to extending React.Component, it works.

guys just read this :)
instead of using a stateless component create a class extending React.Component, just don't be lazy

Something like
`
class SocialLoginButton extends React.Component {

render() {
    return (
        <Button onClick={this.props.triggerLogin} {...this.props}>
          { this.props.children }
        </Button>
    );
}

}

export default SocialLogin(SocialLoginButton);
`
Works like a charm!
I'm using semantic ui, so maybe you want to replace Button with button

@nesymno
Copy link

nesymno commented May 22, 2020

any updates for hooks?

@rgmagebit
Copy link

Still not usable with a functional component.

@deepakaggarwal7
Copy link
Owner

deepakaggarwal7 commented Jun 24, 2021

Can someone share a codesabdbox or similar demo for this issue? thanks

@dulguuned
Copy link

this is state issue, when everything is ready just show the socialbutton

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

10 participants