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

Bug: Trail throws ref error in HMR environment #349

Closed
ooloth opened this issue Dec 4, 2018 · 2 comments
Closed

Bug: Trail throws ref error in HMR environment #349

ooloth opened this issue Dec 4, 2018 · 2 comments

Comments

@ooloth
Copy link
Contributor

ooloth commented Dec 4, 2018

I'm seeing the same error mentioned at the end of this comment about Transition when using Trail in the latest version of Gatsby, which adds the following setting to help react-hot-loader work properly with React hooks:

import { setConfig } from "react-hot-loader"

setConfig({
   ignoreSFC: true,
   pureRender: true,
 })

Here is the error:

Warning: Function components cannot be given refs. Attempts to access this ref will fail.

Check the render method of `AnimatedComponent`.

This error only appears after modifying the react-hot-loader config, so it seems tied to the RHL settings.

Trail still seems to work fine in spite of this error, so I just wanted to check whether the error is important or can be ignored.

@drcmda
Copy link
Member

drcmda commented Dec 5, 2018

Hard to say as i don't know RHL's innards. They probably switch something that previously carries a ref into something that now cannot. I think RHL will only become truly stable once hooks are more prevalent. I'm using the same forwardRef pattern that is on the React page in AnimatedComponent otherwise.

@ooloth
Copy link
Contributor Author

ooloth commented Dec 5, 2018

Thanks! Good to know this isn't a react-spring issue.

I know the RHL maintainers are working hard to prepare for hooks, so I let them know about this error and I'm sure they'll get everything worked out soon.

@ooloth ooloth closed this as completed Dec 5, 2018
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

2 participants