Skip to content

How to render a tree? #1429

Answered by ealmloff
LitchiInn asked this question in Q&A
Sep 4, 2023 · 1 comments · 1 reply
Discussion options

You must be logged in to vote

rsx!{} just creates a fragment of HTML, it will only be rendered if it is returned from a component or used in another rsx!{} that is returned.

In this code, you create a rsx value, but never use it:

rsx! {
    li {
        if !menu.children.is_empty() {
            rsx! {
                details {
                    open: true
                }
                summary {
                    String::as_str(&menu.name)
                }
            }
        }else {
            rsx! {
                ul {
                    li {
                        button {
                            class: "btn btn-xs sm:btn-sm md:btn-md lg:btn-lg",
                            Icon {

Replies: 1 comment 1 reply

Comment options

You must be logged in to vote
1 reply
@LitchiInn
Comment options

Answer selected by LitchiInn
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants