Better HN
top
new
best
ask
show
jobs
Log in
Sign up
Better HN
Comment
by
taoxin
· 2y ago · 0 comments
Yes. This is how VanJS works. Code with VanJS is often more concise compared to equivalent code with React.
Comments
[–]
seanlaff
2y ago
Ah ok! Very cool. Maybe I'm still missing a tiny piece of syntax? I don't see any output when I run that code in the fiddle
https://jsfiddle.net/397fb684/
[–]
taoxin
OP
2y ago
Ah.. you need a binding function to wrap the state-derived content into a reactive UI element, see:
https://vanjs.org/tutorial#state-derived-child
. I made the change in your code to make it work:
https://jsfiddle.net/rkfmpx06/1/
[–]
seanlaff
2y ago
Oh! I understand, thanks for walking through that. Yes very terse compared to the equivalent react :)