Re:Superviews.js, a template engine targeting incremental-dom
by ShellfishMeme on Saturday September 12, 2015 @02:53PM
(#10208914)
Because I have no return values to hold on to. Everything in the render function is a side effect. There's no way to collect the intermediate dom representation in data structures and combine it together later. There is no room for asynchronicity from what I have seen. What if I'd like to combine some reactive streams to send me the desired dom structure as state changes over time, piece them together and send them to the renderer?
Re:Superviews.js, a template engine targeting incremental-dom
by ivank on Saturday September 12, 2015 @03:02PM
(#10208938)
True, you don't have asynchronous template rendering, but you can still asynchronously collect data into your own data structures, then keep re-rendering the whole thing with an incremental-dom render function.
incremental-dom still solves the declarative DOM problem. You express exactly what DOM you want in a template that compiles to incremental-dom calls. It's just a more efficient way to do what React does, skipping the intermediate representation. Why does it matter if the incremental-dom calls have side effects, if the end result (of an updated DOM) is the same?
If you use the DOM directly as you suggest, you end up writing a lot of manual state transitions, and probably bugs from not covering and testing absolutely every transition. incremental-dom doesn't have that problem because it's updating the whole tree for you, just like React.