Hook for simplifying usage of tv in typescript #108
DanielFlores-OG
started this conversation in
Ideas
Replies: 3 comments
-
The value here seems very marginal, so definitely not something I forsee adding to the core of tailwind-variants. If it works for you great, but again doesn't add much value IMO. |
Beta Was this translation helpful? Give feedback.
0 replies
-
This should not be a "hook" since it doesn't use any React built-in hook. It would be misleading when using in RSCs i.e. |
Beta Was this translation helpful? Give feedback.
0 replies
-
Here's what I do in my projects: |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Hi
I wanted to share with you a small hook I wrote to simplify the usage of tv in typescript. This is for slots but would be nice to have something similar built-in.
The hook useTv.tsx looks like this:
That way, when declaring the component there is no need to extend the type of it or write again the name of every slot destructuring the result of tv().
You can play with it here:
https://codesandbox.io/s/talwind-variants-for-react-typescript-gmp7p9
Beta Was this translation helpful? Give feedback.
All reactions