News for hackers. Stuff that matters.
Re:Riot – A React-like, 2.5K user interface library by otikik on Thursday January 22, 2015 @07:03AM (#8928699)
You are right, I will have to investigate more. I don't know how much of react's virtual dom diff can you cram in 2.5kb though :)
Re:Riot – A React-like, 2.5K user interface library by tipiirai on Thursday January 22, 2015 @07:09AM (#8928718)
Not much. The point is that such heavy diffing can be avoided if loops and conditionals are enough and if you don't need random HTML changes.
Re:Riot – A React-like, 2.5K user interface library by masklinn on Thursday January 22, 2015 @07:29AM (#8928796)
Once you have loops, conditionals and recursion, don't you have "random HTML changes"?
Re:Riot – A React-like, 2.5K user interface library by tipiirai on Thursday January 22, 2015 @07:29AM (#8928797)
Exactly. Loops and conditionals should give you enough power.

But in React you can arbitrarily change HTML because the render method returns a string to be compared to the earlier situation.

A tag name can change for example (which you rarely need).

Re:Riot – A React-like, 2.5K user interface library by masklinn on Thursday January 22, 2015 @07:33AM (#8928808)
> But in React you can arbitrarily change HTML because the render method returns a string to be compared to the earlier situation.

I'm pretty sure the render method returns a vdom node (which the library can then diff and merge into the actual DOM)

Re:Riot – A React-like, 2.5K user interface library by masklinn on Thursday January 22, 2015 @07:21AM (#8928750)
As a point of reference, virtual-dom is 17k when minified with the same settings and 5.8k when gzipped.

That's starting from the 42k 1.2.0 distfile.