Open marc2332 opened 7 months ago
To solve this we'll override the manual props children with the explicit children since that seems like the most sensible/consistent behavior.
I think the way we spread props is fundamentally flawed. It doesn't go through the builder, so none of the prop attributes are applied. Which means you can't spread into something with props(extends = ...)
or props(into)
The into for string doesn't get called when you spread which breaks this example:
fn testing() -> Element {
rsx! {
Component { a: "hello", ..ComponentProps { a: "hello 123".to_string(), b: "world".to_string() } }
}
}
#[component]
fn Component(a: String, b: String) -> Element {
rsx! {
div { "{a}" }
div { "{b}" }
}
}
Currently, spreaded props of Components will take over any children that you pass later, this aligns with Rust's way of spreading structs, but it might be counterintuitive for some users when used in Dioxus
Example:
Workaround: