Repository navigation
Conversation
|
I’d highly recommend using data attributes for this, that’s what they’re
intended for.
…On Thu, Oct 3, 2019 at 10:22 AM Ken Kelly ***@***.***> wrote:
This PR came up because we were using v3 and were passing in what are
being determined as invalid attributes. We upgrade for v4 to fix another
styling issue and found out our analytics broke.
We use these attributes for our analytics tracking to have simple event
listeners set up globally.
<button anclick="home_page_button" type="primary"
class="buttonstyled__Button-sc-1t8li5e-0 YHsJf">HomePage</button>
The usage to achieve bring the attributes back is by simply adding
shouldForwardProps to the styled component.
return <StyledButton
anclick={anclick}
anevent={anevent}
atc={atc}
btnsize={btnsize}
btnwidth={btnwidth}
disabled={disabled}
id={id}
onClick={this.onClick}
type={type}
ref={forwardedRef}
shouldForwardProps
{...this.props}
>
{children}
</StyledButton>;
------------------------------
You can view, comment on, or merge this pull request online at:
#2780
Commit Summary
- Add new param shouldForwardProps to allow the passing in of
'invalid' attributes.
File Changes
- *M* packages/styled-components/src/models/StyledComponent.js
<https://github.com/styled-components/styled-components/pull/2780/files#diff-0>
(5)
Patch Links:
-
https://github.com/styled-components/styled-components/pull/2780.patch
- https://github.com/styled-components/styled-components/pull/2780.diff
—
You are receiving this because you are subscribed to this thread.
Reply to this email directly, view it on GitHub
<#2780?email_source=notifications&email_token=AAELFVWKCQIRYG3CDJEKRSDQMX5Z7A5CNFSM4I5DZO4KYY3PNVWWK3TUL52HS4DFUVEXG43VMWVGG33NNVSW45C7NFSM4HPNNCGA>,
or mute the thread
<https://github.com/notifications/unsubscribe-auth/AAELFVWI63ENQLXMQF73QH3QMX5Z7ANCNFSM4I5DZO4A>
.
|
|
Hind-sight, but we are a large e-commerce site and that would require a ton of refactor. That's why I made the one prop that is opt-in for us and for those that might also have something similar where white-listing of attributes is a stopper.
|
|
If we were to add something like this, I think emotions way is a better choice. I'm all for adding this functionality, currently we have to "hack" around this with a custom component passed through the |
|
I agree with @alexandernanberg. Thanks for your PR but not the overall solution we're aiming for... |
|
@probablyup If I'd open a PR with the proposed solution, is that something you'd consider merging? Or is more discussion around this needed? |
|
Yeah, alright. We need to make sure the instances fold properly though (see
the attrs implementation.) I’m not 100% on the name at the moment
…On Fri, Jan 31, 2020 at 2:14 AM Alexander Nanberg ***@***.***> wrote:
@probablyup <https://github.com/probablyup> If I'd add a PR with the
proposed solution, is that something you'd consider merging? Or is more
discussion around this needed?
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
<#2780?email_source=notifications&email_token=AAELFVVJTOQKKYXOF7JPQJLRAPFV7A5CNFSM4I5DZO4KYY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOEKNXIFY#issuecomment-580613143>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AAELFVTTQK5QJRYXT7NEPQLRAPFV7ANCNFSM4I5DZO4A>
.
|
|
As far as I'm aware, #2392 implemented shouldForwardProp in the same way as emotion. Can this PR be reopened? |
|
Looks like @stevesims reopened in #3006 👍 |
This PR came up because we were using v3 and were passing in what are being determined as invalid attributes. We upgrade for v4 to fix another styling issue and found out our analytics broke.
We use these attributes for our analytics tracking to have simple event listeners set up globally.
<button anclick="home_page_button" type="primary" class="buttonstyled__Button-sc-1t8li5e-0 YHsJf">HomePage</button>The usage to achieve bring the attributes back is by simply adding
shouldForwardPropsto the styled component.