Code simplify #2156
Replies: 3 comments
-
You can use the #[component]
pub fn Someelement(children: Element)->Element{
rsx!{{value}}
} |
Beta Was this translation helpful? Give feedback.
-
Thanks a lot. But how to deal with the following one which is a bit more complex?
I want to use Welcome{"Lotus",8} instead of Welcome{name:"Lotus",index:8} |
Beta Was this translation helpful? Give feedback.
-
You cannot do that with dioxus. Components are more like structs than functions. If you have no state or hooks in your "component" you can call it like a normal function, but keep in mind that it will not be memorized and cannot use hooks |
Beta Was this translation helpful? Give feedback.
-
How to simpify the following code to use Someelement{"message"} instead of Someelement{value:"message"}?
====================================
Thanks for any response.
Beta Was this translation helpful? Give feedback.
All reactions