Css helper component with passed in prop in TS #3983
Unanswered
quinnvaughn
asked this question in
Q&A
Replies: 1 comment
-
I can do this as a function that returns the css helper, and takes in the width as a param, but that seems like a less than ideal solution, but possibly the only one.
Usage
|
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
-
(This is partly a TS question)
So I have a bunch of width styles that I reuse for a wide variety of components. Unfortunately right now I'm duplicating them. However, if I want to DRY it, I need to pass in a prop that is an object (it's a bunch of breakpoints). It looks like so:
I can make the component fine with the css helper but I don't know how to add them to another component. It's very easy if you don't have any props, you just
${style}
them, but it throws an error when you're passing in a prop. Does anyone know how to correctly add the styles or am I just SOL?I am also open to doing the same thing a different way.
Beta Was this translation helpful? Give feedback.
All reactions