-
Notifications
You must be signed in to change notification settings - Fork 671
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
Remove @emotion/styled dependency #1183
Comments
Hey @MMT-LD 👋 Thanks for the issue! This is the same problem as mentioned in #1124.
You could work around this
const BoxButButton = Box.withComponent("button")
Additional context: chakra-ui/chakra-ui#1582 |
@hasparus thanks for the workarounds. However, i think the JS community seems to be going towards typescript more and more (from looking at other libs and conversations) and i think if theme-ui could support the 'As' prop like Chakra, looks like they made significant progress over the last month, then that would be an amazing feature - otherwise its really only useful for non typescript users. Unless i'm missing the point of Box? or maybe we should be using/consuming the components differently? Back to your points:
Let me say that i really like this lib and i know how much work everybody puts into keeping a lib like this going 👍 |
I've spent a bunch of time fiddling with it, and I'm not convinced it's an amazing feature. TypeScript compilation times suffer drastically in large codebases using Pretty soon, with React Automatic Runtime, you won't even need Additional context: |
@hasparus just wanted to get clarification on withComponent from emotion so i asked the question. Issue: emotion-js/emotion#2012 |
@lachlanjc, I agree we should describe it in the docs, but we could move on this. I agree with Andarist (emotion-js/emotion#2012 (comment)), that |
That sounds great, though will be a breaking change in requiring |
Papertrail: we deprecated |
Hey,
If i use Box and then i apply ref forwarding on a new component called button. It would seem that in typescript when using forward ref it seems that box is set to HTMLDivElement and if i supply HTMLButtonElement we get error that it needs to be a div element, i assume this is to do with the 'as' prop?
Just wandered what i'm doing wrong - i even tried the typings for ForwardRef and it still did not work. TS version 4.0.2
for example:
for now my fix is lame but its all i have got ;-)
ref={ref as any}
looking on emotion comments and it looks like the as prop has been thought about by different source - maybe a good reference?
https://github.com/kripod/react-polymorphic-box/blob/main/src/Box.tsx
Thanks in advance ;-)
The text was updated successfully, but these errors were encountered: