Forwarding props to an underlying component #4239
Closed
jakesarjeant
started this conversation in
General
Replies: 1 comment
-
Oh, wait, just discovered #1179. So, looks like this is coming in a release soon. Welp, I feel stupid now |
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
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
When using React, I often create components that are "wrappers" around existing HTML elements. For example,
MyAppButton
would be a component that wraps an HTML<button>
, applies my styles and maybe some special behaviors like a custom tooltip.For convenience, I would declare the props as
type MyButtonProps = {...} & React.ButtonHTMLAttributes<...>
and then forward the rest of the props with{...props}
. Here's a pseudo-code example:I imagined I'd be able to do something along the lines of this in dioxus (pseudo-code again):
But after looking around the docs for a bit, it seems like that's not a thing? Am I stuck defining each and every prop I want to forward explicitly by adding a corresponding prop to my component's props?
Beta Was this translation helpful? Give feedback.
All reactions