Skip to content

What I am going wrong? #207

Discussion options

You must be logged in to vote

For state-derived UI elements, you need to wrap them into a binding function that returns the UI element. If a list of elements need to be rendered (in your example, posts.val.map(...)), they can be wrapped by a pass-through container (<span> for inline elements and <div> for block elements).

Thus in your example, the return statement can be changed to:

    return div({class: "flex text-3xl"},
        () => div(posts.val ? posts.val.map(p => span("AAA")) : span("LOADING")))

Hope it helps :-)

Replies: 1 comment 5 replies

Comment options

You must be logged in to vote
5 replies
@richcorbs
Comment options

@Tao-VanJS
Comment options

@richcorbs
Comment options

@Tao-VanJS
Comment options

@richcorbs
Comment options

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