DioxusLabs / DioxusLabs/dioxus
Support Ability To Extend Props From Other Props
- Dominant language
- Rust
- Stars
- 39.1k
- Forks
- 1.9k
- Avg merge
- 4d 10h
- Merged PRs (30d)
- 4
Description
## Feature Request
It'd be helpful to have the ability to extend from another component's props:
```rust
#[derive(Props, Clone, PartialEq)]
pub struct Comp1Props {
abc: bool,
disabled: bool,
}
// .. fn Comp1()
#[derive(Props, Clone, PartialEq)]
pub struct Comp2Props {
// extend prop attributes by specifying component fn or prop struct
#[props(extends = Comp1)]
attributes: Vec,
}
#[component]
pub fn Comp2(props: Comp2Props) -> Element {
rsx! {
Comp1 {
disabled: false, // add your own props as desired
..props.attributes, // spread any generic prop through components
}
}
}
```
Contributor guide
No contributing guide indexed for this repository
Assessment
This issue has not been assessed yet.