Live data from Hacker News

Riot – A React-like, 2.5K user interface library

muut.com

61–70 of 222 posts

Re: Riot – A React-like, 2.5K user interface library

#61

Earlier quoted context omitted.

Virtual DOM implementation is indeed different. The biggest reason for calling it "React-like" is the basic idea of components, where related HTML and JS are combined together. > "Build components, not templates" http://www.slideshare.net/floydophone/react-preso-v2 I think this is the "what" of React and virtual DOM is the "how".

I don't think of something as React-like just because it puts HTML and JS in the same file or combines HTML tags with blocks of JS code. The difference between React and other databinding methods is that you can use all JS language features (i.e. if, for, while, .filter(), .map(), libraries like Rx.js, etc.) when defining what you want your DOM to look like. Suppose I want to have a list of items based on some array,…

In Riot you need to do following:

  

  

  // use JS to construct items
  this.items = arr.map(fn) // or how you want it

And you can also manipulate items on every update. I'm sure that at some point there will be a clear use case where React is a better choice.

So far Riot rendering has worked us perfectly.

Re: Riot – A React-like, 2.5K user interface library

#62

Earlier quoted context omitted.

> Benchmarks are definitely coming. Beware the way you're benchmarking, e.g. immutable structures and pure (& immutable-state-aware) components can make a pretty huge difference in react.

Yes. This is indeed a big challenge. Maybe I can just use the TodoMVC app.

Yeah Matt Esch (virtual-dom) has a bench based on todomvc: https://github.com/matt-esch/mercury-perf http://matt-esch.github.io/mercury-perf/

Or http://evancz.github.io/todomvc-perf-comparison/ which seems to be an older version of the same bench but has a better output.

Re: Riot – A React-like, 2.5K user interface library

#63

I feel sorry for people who have to write native JS at this point. I can't imagine a JS job interview where you didn't have to know of/about yet another framework.

Great to have some innovation on the frontend for once. We're getting closer and closer to a place where we can write flexible, performant interfaces without the heavy frameworks and tooling of native frontend dev.

Re: Riot – A React-like, 2.5K user interface library

#64

Earlier quoted context omitted.

Yes. This is indeed a big challenge. Maybe I can just use the TodoMVC app.

Yeah Matt Esch (virtual-dom) has a bench based on todomvc: https://github.com/matt-esch/mercury-perf http://matt-esch.github.io/mercury-perf/ Or http://evancz.github.io/todomvc-perf-comparison/ which seems to be an older version of the same bench but has a better output.

Thanks. I think comparing Riot with React is most important initially. And there is no Riot 2.0 TodoMVC example available yet.

I also think that Riot performance can be further optimized.

Slowly getting there...

Re: Riot – A React-like, 2.5K user interface library

#67
Very cool project! I have used nearly every framework under the sun and React is, by far, my favorite. It's getting better every release. The concepts it introduces are sound, and I don't think I'd ever do frontend development any other way.

That said, Riot is a very encouraging take on React - and I think it may have a very solid place in apps that need to be very light and fast. Perhaps it's perfect for prototyping. I will try to find a small project for it.

One question; is there any way to render to a string so Riot can be used server-side?

Re: Riot – A React-like, 2.5K user interface library

#68
post #67

Very cool project! I have used nearly every framework under the sun and React is, by far, my favorite. It's getting better every release. The concepts it introduces are sound, and I don't think I'd ever do frontend development any other way. That said, Riot is a very encouraging take on React - and I think it may have a very solid place in apps that need to be very light and fast. Perhaps it's perfect for prototyping…

Server side rendering is on the roadmap among other things. Look for the last item on the FAQ:

https://muut.com/riotjs/faq.html

Re: Riot – A React-like, 2.5K user interface library

#69
post #6

Earlier quoted context omitted.

Maybe you can find the answer from the comparison section: https://muut.com/riotjs/compare.html

Maybe I'm missing something, but that comparison looks like apples versus oranges, or more specifically JavaScript-side versus HTML-side. The React example looks like the JS-side only, while the Riot example looks like the HTML-side only. What am I missing? edit: I see a touch of embedded script (i.e. handleSubmit) in the Riot example, but not nearly enough to replicate the JS code in the React example. And there is…

I haven't used React in about 6 months, but I'm pretty certain the Riot code does the exact same thing.

If you haven't used React, it has JSX as syntactic sugar for what would otherwise be a bunch of javascript: see the "render" function in createClass. So a component is written in JS.

With Riot, the JS goes into the template to create a component.

There's a lot of things to like about React, but it requires some boilerplate and a larger API in order to support the amount of freedom it offers in updating (that Riot page goes into this a bit).

If you want something that keeps the HTML and JS separate but still allows components, while having a straightforward API along with a small file size, check out knockoutjs.com

Re: Riot – A React-like, 2.5K user interface library

#70
Hm. How does this compare to Mithril JS (http://lhorie.github.io/mithril/)?

I just looked at the doc and read this thread (at 61 comments).

Same:

* virtual dom * has its own tag syntax * Mithril has MSX, but also supports regular JS data structure with m("tag", {attr:val, onclick: func, [more tags, "text"]} * router

Different:

* Where Mithril allows you to build and transform resulting template structure before virtual DOM generation, Riot mixes HTML tags and JS, builds tags from that which can be composed * Uses a compiler, Mithril without MSX can work directly in the browser * Probably other stuff, too, I'm just reading the examples, at least is not supported Ajax/XHR

Speed is a big question. Mithril is plenty fast (there's a benchmark on the home page, and somewhere I saw a TodoMVC comparison which put Mithril near the top few months back).

I have not yet formed an opinion, but RiotJS' size and web component approach intrigue me. More example apps, plz, with client/server communication and CRUD ops.

Post reply on HN