Genie Discord forum

Author Avatargvdr
9/14/2023, 11:27:36 PM

Hello,

I'm building an app using the GenieFramework through VS code (is that still a good thing?).

I've a dynamic list of words, declared as an @out listwords variable.

I would like to show it in the UI, updating the view each time the list changes. How do I do it?

My minimal setting is something like:

module App
# set up Genie development environment
using GenieFramework
@genietools

function get_keywords(uid)
    words = #... do something
    return words
end

@app begin
    @in userid = 0
    @out listkeywords = ["One word"]

    @onchange userid begin
        listkeywords = get_keywords(userid)
    end

end

@page("/", "app.jl.html")
end

What should I insert in the app.jl.html to loop through the keywords and show them accordingly?

Author Avatarjeremiedb
9/19/2023, 12:20:37 AM

@recur may be what you're looking for. For example:

      p("{{item}}", @recur(:"item in listkeywords"))