-
Hi I am using vanjs creating a jsx-runtime. I found the todo list here. https://vanjs.org/demo#todo-list But still have two problem.
What are your best practices for writing todolists using vanjs? |
Beta Was this translation helpful? Give feedback.
Replies: 2 comments 2 replies
-
I have create a easy demo. But it not works fine. After each input in the input box. The list will be re-execute. So I can't do continuous input
|
Beta Was this translation helpful? Give feedback.
-
Regarding your comments:
VanJS doesn't require your app to be 100% fully reactive. Like mentioned in https://vanjs.org/demo#todo-list, you can choose to build your app in a fully procedural way, a hybrid way between procedural and reactive, or a fully reactive way like the sample app I just demonstrated in this thread, which derives the entire TODO list from a state.
You can definitely extend the |
Beta Was this translation helpful? Give feedback.
Hi @cqh963852,
Regarding your demo, you can make the values of the
items
list nested states ofstring
. In this way, theoninput
event handler needs only to update thevalue
state, instead of refreshing the entireitems
list.Thus, your program can be modified like this: