Do not pass suppressClassNameWarning to wrapped components
See original GitHub issueEnvironment
System:
- OS: macOS 10.14
- CPU: (4) x64 Intel® Core™ i5-7267U CPU @ 3.10GHz
- Memory: 75.45 MB / 8.00 GB
- Shell: 3.2.57 - /bin/bash
Binaries:
- Node: 8.15.0 - /usr/local/opt/node@8/bin/node
- npm: 6.4.1 - /usr/local/opt/node@8/bin/npm
npmPackages:
- babel-plugin-styled-components: ^1.10.0 => 1.10.0
- styled-components: ^4.1.3 => 4.1.3
Summary
- suppressClassNameWarning produces React warning suppressClassNameWarning should either only be using lowercase letters instead of camelCase, or it should be filtered from being applied to the DOM. Otherwise, React complains.
Reproduction
Steps to reproduce
- add suppressClassNameWarning as a property or attribute
Expected Behavior
- styled-components warning is suppressed
Actual Behavior
- styled-components warning is suppressed but then React gives warning:
Warning: React does not recognize the suppressClassNameWarning
prop on a DOM element. If you intentionally want it to appear in the DOM as a custom attribute, spell it as lowercase suppressclassnamewarning
instead. If you accidentally passed it from a parent component, remove it from the DOM element.
Issue Analytics
- State:
- Created 5 years ago
- Comments:15 (8 by maintainers)
Top Results From Across the Web
styled-components is saying wrapped styled() around your ...
It looks like you've wrapped styled() around your React component (Component), but the className prop is not being passed down to a child....
Read more >Releases - styled-components
Updating styled components is usually as simple as npm install . ... Filter suppressClassNameWarning to not to pass down to the wrapped components...
Read more >styled-components | Yarn - Package Manager
Interpolating a styled component into a string now returns the static component selector (emotion cross-compat) · Add suppressClassNameWarning prop to disable ...
Read more >Higher-Order Components - React
While the convention for higher-order components is to pass through all props to the wrapped component, this does not work for refs. That's...
Read more >styled components suppressClassNameWarning
CodeSandbox is an online editor tailored for web applications. ... styled components suppressClassNameWarning. 0. Embed Fork Create Sandbox Sign in.
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
I lightly suggest in https://github.com/styled-components/styled-components/blob/fe66a4f9aae8f4736c8c6bc08df64e56d892844d/src/utils/classNameUseCheckInjector.js
Change from:
Change to:
Aha, understood! Can I address this issue? If so, I will send PR later! 😄