Perf: About the as
prop [RFC]
#2216
-
Hey Chakra friends, I had a test of I have some questions in mind, please feel free to reply with your answers to this:
Get rid of the type inference in the // Instead of doing this. TS is slow
<Button as="a" href="..."></Button>
// Use the escape hatch
<Button as="a" asProps={{ href : "..." }}></Button> Leverage the Chakra factory function // Instead of doing this. TS is slow
<Box as={CustomComponent} />
// Use the chakra function
const Comp = chakra(CustomComponent) Leverage the chakra object for common HTML elements // Instead of doing this. TS is slow
<Box as="a" href="..." />
// Use the chakra object
<chakra.a href="..."></chakra.a> Let me know your thoughts. The goal is to make this final decision for v1 before the official release (end of October). |
Beta Was this translation helpful? Give feedback.
Replies: 6 comments 7 replies
-
Do you have an example of this? I've honestly not been noticing any issues. |
Beta Was this translation helpful? Give feedback.
-
Beta Was this translation helpful? Give feedback.
-
My team and I are experiencing this issue as well, although until now I didn't know it was because of the It's annoying and hampers DX a bit, but isn't the end of the world. I prefer having Having said that, being able to have ❤️ your work team |
Beta Was this translation helpful? Give feedback.
-
I am using the The lagging TS interference is an issue for me, because it slows me down. Personally I rank the DX higher than the perfect TS interference. The introduction of As @ljosberinn mentioned, the Flex component would be obsolete due |
Beta Was this translation helpful? Give feedback.
-
FWIW, I think Whereas the |
Beta Was this translation helpful? Give feedback.
-
Updates: We managed to figure out a way to keep the We'll keep an eye out for things we can improve in the future regarding this. Cheers |
Beta Was this translation helpful? Give feedback.
Updates: We managed to figure out a way to keep the
as
props, infer types correctly (not 100% perfect though), and get fast IntelliSense in VSCode and WebStorm (IntelliJ).We'll keep an eye out for things we can improve in the future regarding this.
Cheers