Tobias Uhlig
May 29, 2021

--

You got the concept wrong. JSON based vdom is not a template, so if and else statements as well as loops don’t belong in there.

This does NOT mean, that you should not use loops to generate repeating blocks of code. On the contrary: you can run loops inside config change handlers (afterSetConfig() methods) and since we have an object / array based tree we can easily manipulate it any way you can think of at run time.

E.g. take a look at the helix implementation, to get an idea (complex one):
https://github.com/neomjs/neo/blob/dev/src/component/Helix.mjs

Unless you are creating new components, you will most likely not get in touch with the vdom on a low level. For apps, there is a “component tree” abstraction layer build on top of the vdom structure which feels more declarative.

Example: https://github.com/neomjs/neo/blob/dev/apps/covid/view/MainContainer.mjs#L33

Have a nice weekend!

Best regards,
Tobias

--

--

No responses yet