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.StrictMode Usage Results in findDOMNode Warning as styled-components uses it #11

Open
joealden opened this issue Nov 16, 2018 · 1 comment
Labels
upstream The issue is dependent on an upstream issue

Comments

@joealden
Copy link
Owner

Now that StrictMode has been enabled for the site, the following warning is logged to the console:

Warning: findDOMNode is deprecated in StrictMode. findDOMNode was passed an instance of StyledComponent which is inside StrictMode. Instead, add a ref directly to the element you want to reference.

This is because as mentioned in styled-components/styled-components#2154 (comment), there is no other suitable alternative to the findDOMNode method currently in React for styled-components' use case. The React team have said that they are thinking about implementing a solution for this unhandled use case (facebook/react#13841 (comment)).

For now, nothing can be done, as styled-components is waiting on React to implement a solution. This issue is here as a reference to explain why this error is logged to the console in dev mode.

@joealden joealden added the upstream The issue is dependent on an upstream issue label Nov 16, 2018
@joealden
Copy link
Owner Author

An RFC for fragment refs has been created (reactjs/rfcs#97).

If this RFC is approved, implement and merged, then it will likely give styled-components the ability to stop relying on findDOMNode in React versions that support the above feature.

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

No branches or pull requests

1 participant