Who thinks adding a prefix of $ is the right solution to React complaining about non-DOM props?!
#4105
-
|
I personally hate it. It's giving me PHP vibes, or Angular. "Let's just add a new symbol because we don't know how else to solve this" isn't the right approach IMO Which is made even more unreadable in the definition of the styled-component: Maybe my favourite though is: |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment
-
|
The The alternative before transient props was using |
Beta Was this translation helpful? Give feedback.
The
$prefix for transient props is by design. It provides a simple, zero-config mechanism to prevent custom props from leaking to the DOM — React warns when unknown props are passed to HTML elements.The alternative before transient props was using
.withConfig({ shouldForwardProp })on every component or wrapping withStyleSheetManager shouldForwardProp={...}globally (e.g. with@emotion/is-prop-valid). The$convention is opt-in and avoids that boilerplate.