Get help from the marimo community

Updated 24 hours ago

Alternative to mo.state() for Keeping Track of a List

Hi everyone,
Here’s what I want to do:
I have a list a = []
I also have b = mo.ui.text().
I want a to keep appending b.value every time I enter new text into b.
The only working solution I’ve found so far is using mo.state().
I’m wondering if anyone has a better solution that doesn’t require mo.state().

Thank you! 🙏
S
1 comment
Plain Text
some_list = []
text_input = mo.ui.text(label="Enter")

text_input

Plain Text
if text_input.value != "":
    some_list.append(text_input.value)

some_list


this should work without mo.state :>
Add a reply
Sign up and join the conversation on Discord