-
Notifications
You must be signed in to change notification settings - Fork 255
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
compose component not support "as" prop #979
Comments
From example, Button is probably a wrapper on styled component. Possible temporary workaround can be like this: function Button(...) {
//...
return <StyledButton {...} />
}
Button[Symbol.for('sxs.internal')] = StyledButton[Symbol.for('sxs.internal')] ; I don't like this but at least it can be as a temporary workaround until it's solved in Stitches. UPD This workaround still doesn't solve the problem when Button component has some custom props and you want to use it: function Button({ customProp, ...rest }) {
//...
return <StyledButton {...rest} />
}
Button[Symbol.for('sxs.internal')] = StyledButton[Symbol.for('sxs.internal')] ;
const MyButton = styled(Button, {
background: 'red',
});
// `customProp` won't work because it's passed to `a` instead of `Button`
<MyButton as="a" customProp="foo">
hello world
</MyButton> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Bug report
Describe the bug
It is normal for the original component to use "as" prop, However, after the compose the component and use "as", the original attributes are lost.
To Reproduce
System information
The text was updated successfully, but these errors were encountered: