Skip to content
This repository has been archived by the owner on Apr 13, 2023. It is now read-only.

React Hot Loader v3 "this component is not accepted by Hot Loader" error #1234

Closed
dizlexik opened this issue Oct 12, 2017 · 2 comments
Closed

Comments

@dizlexik
Copy link

After switching to React Hot Loader v3 I'm now getting the following error:

React Hot Loader: this component is not accepted by Hot Loader. 
Please check is it extracted as a top level class, a function or a variable. 
Click below to reveal the source location: 
 ƒ GraphQL(props, context) {
...

And the source is https://github.com/apollographql/react-apollo/blob/master/src/graphql.tsx#L101

I was getting plenty of errors like this with my own code too until I updated everything to export each intermediate HOC as described in the React Hot Loader FAQ here: https://github.com/gaearon/react-hot-loader/blob/master/docs/Troubleshooting.md#react-hot-loader-this-component-is-not-accepted-by-hot-loader

Would you consider moving the GraphQL component outside of wrapWithApolloComponent and exporting it? There's really nothing functionally wrong with the code as it currently is, but this would help with hot module reloading, and clear up this annoying error message.

@dizlexik
Copy link
Author

Looking more closely at this it seems like this change is probably more painful than the benefit is worth. I'm going to close this for now and give it more thought. Sorry for the distraction.

@transcranial
Copy link

Using https://github.com/quangbuule/extract-hoc solved this problem for me (see gaearon/react-hot-loader#650). Only issue is compose(...) still doesn't work.

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

No branches or pull requests

2 participants