You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Filter props which are passed to underlying component #2467
As written in the documentation non-html-standard props are filtered out.
But this seems to be only the case for styled HTML-elements not for styled components.
Which is okay if I style my own components and thus have control which props are getting passed along to the DOM. But if I do not, I will get an error.
In my case, I have a wrapper for the react-bootstrap Component Panel, which should just serve as an example of a component that I do not 'control'.
Environment
System:
OS: Windows 10
CPU: (8) x64 Intel(R) Core(TM) i7-3632QM CPU @ 2.20GHz
Activity
quantizor commentedon Mar 28, 2019
Duplicate of #439
lcswillems commentedon Nov 15, 2019
I have just written an RFC for filtering forwarded props: #2878
Would you like a solution like this?
TL;DR It consists of adding a second parameter for filtering props. The current solution:
is turned into:
This is easy to write and to understand, and props filtering (which is not the important part of the definition) is sent at the end of the definition.
cryptiklemur commentedon Dec 30, 2019
This solution is nice, but eslint (and other linters) may complain that variables are defined that arent being used
Fixed Error when forwarding custom props to Link
TrevorSayre commentedon Apr 8, 2020
@aequasi https://eslint.org/docs/rules/no-unused-vars#ignorerestsiblings
adrianhelvik commentedon Nov 2, 2020
This is not a very ergonomic solution and does not take into account ref forwarding. What about:
quantizor commentedon Nov 2, 2020
We won't be iterating further on this API. My recommendation would be to use transient props if you want something for styling purposes but not to be passed on. https://styled-components.com/docs/api#transient-props