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

Warning: The <withAvatarConfig /> component appears to be a function component that returns a class instance. #171

Open
dnizetic opened this issue Aug 21, 2019 · 5 comments
Labels
incomplete Needs more info to resolve

Comments

@dnizetic
Copy link

dnizetic commented Aug 21, 2019

I switched to a newer version of React - 16.8.6. After doing so Avatar started throwing this warning:

Warning: The <withAvatarConfig /> component appears to be a function component that returns a class instance. Change withAvatarConfig to a class that extends React.Component instead. If you can't use a class try assigning the prototype on the function as a workaround. withAvatarConfig.prototype = React.Component.prototype. Don't use an arrow function since it cannot be called with newby React.

Screen Shot 2019-08-21 at 5 06 56 PM

@JorgenEvens
Copy link
Member

Hi @dnizetic,

Could you provide a codesandbox that is throwing this warning?

@JorgenEvens JorgenEvens added the incomplete Needs more info to resolve label Aug 21, 2019
@dnizetic
Copy link
Author

dnizetic commented Aug 21, 2019

Looks like I am on my own because in Sandbox with React 16.8.6 it doesn't throw the warning:

https://codesandbox.io/embed/react-example-xgnnf

Probably react-hot-loader may be interfering or something else.

@JorgenEvens
Copy link
Member

Hi @dnizetic,

Did you ever find out what was causing this issue for you?
Would you mind sharing how you fixed the issue, should anyone else ever run into this issue.

@hlodver
Copy link

hlodver commented Oct 24, 2019

I have the same issue and I am using react-hot-loader. If I remove that then it works fine. I haven't yet found a solution or put effort into it since it is only a warning in the dev environment.

@hijarian
Copy link

I have solved this issue in my environment but it maybe not a generic case. Let me tell the details here in case somebody would figure out what happens.

I am using Gatsby and in dev environment (with hot reloading enabled) I always saw this warning in the console. However, at the same time, I had another warning message related to the following react-hot-loader issue in Gatsby: gatsbyjs/gatsby#11934. Following the suggestion from the bottom of this specific comment in that thread: gatsbyjs/gatsby#11934 (comment) fixed both issues simultaneously.

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

No branches or pull requests

4 participants