codify "platform" into resolution logic, server-fn/fullstack overhaul (#4596)
overhaul dioxus fullstack using a new implementation of server_fn This PR is a complete rewrite of dioxus fullstack designed to improve compatibility with axum and to fix a number of compilation errors based on feature flag unification plumbing through macros.
This commit is contained in:
1 parent
8421c3aef0
commit
f2b1c6d97f
424 files changed
+17284
-6624
No files matched your search
@@ -0,0 +1,43 @@
|
||||
//! This example demonstrates how to use the spread operator to pass attributes to child components.
|
||||
//!
|
||||
//! This lets components like the `Link` allow the user to extend the attributes of the underlying `a` tag.
|
||||
//! These attributes are bundled into a `Vec<Attribute>` which can be spread into the child component using the `..` operator.
|
||||
|
||||
use dioxus::prelude::*;
|
||||
|
||||
fn main() {
|
||||
let dom = VirtualDom::prebuilt(app);
|
||||
let html = dioxus_ssr::render(&dom);
|
||||
|
||||
println!("{}", html);
|
||||
}
|
||||
|
||||
fn app() -> Element {
|
||||
rsx! {
|
||||
SpreadableComponent {
|
||||
width: "10px",
|
||||
extra_data: "hello{1}",
|
||||
extra_data2: "hello{2}",
|
||||
height: "10px",
|
||||
left: 1,
|
||||
"data-custom-attribute": "value",
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#[derive(Props, PartialEq, Clone)]
|
||||
struct Props {
|
||||
#[props(extends = GlobalAttributes)]
|
||||
attributes: Vec<Attribute>,
|
||||
|
||||
extra_data: String,
|
||||
|
||||
extra_data2: String,
|
||||
}
|
||||
|
||||
#[component]
|
||||
fn SpreadableComponent(props: Props) -> Element {
|
||||
rsx! {
|
||||
audio { ..props.attributes, "1: {props.extra_data}\n2: {props.extra_data2}" }
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user