Get tw as prop from component #510
Answered
by
ben-rogerson
ddanielcruzz
asked this question in
Q&A
-
Hey there! Is there a way to pass the I want something like this const Component = ({tw}) => <section tw={tw}>hello</section>
...
<Component tw="text-green-500" /> I know this works const Component = ({...props}) => <section {...props}>hello</section>
...
<Component tw="text-green-500" /> But I'd like to avoid it as I want to be specific about the props I pass to my component. Thanks! |
Beta Was this translation helpful? Give feedback.
Answered by
ben-rogerson
Aug 18, 2021
Replies: 1 comment 2 replies
-
Hey! Try passing className down onto the html element: const Component = ({ className }) => <section {...{ className }}>hello</section>
<Component tw="text-green-500" /> |
Beta Was this translation helpful? Give feedback.
2 replies
Answer selected by
ddanielcruzz
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Hey!
Try passing className down onto the html element: