Live data from Hacker News

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

muut.com

121–130 of 222 posts

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

#121

One of the biggest selling points for React/Flux for me was the fact that it had been proven by Facebook and Instagram on some very large projects. What has this been used on?

The group releasing it has a drop in forums/commenting system called "Muut" that is fantastic. We needed a private forum system and it was one of the easiest integrations I've ever done. Really solid work.

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

#122
post #110

One thing I like React is it is plain javascript. Therefore I can use coffeescript to describe the component: {div, p, ul, li} = React.DOM ... render: -> div className: 'foo', p className: 'bar', 'blabla' p className: 'bar', 'blabla' ul className: 'somelist', @state.items.map (x) -> li key: x.id, x.content If Riot.js uses a custom parser, it may not be able to do this.

I still think that a declarative language is more suitable to describe the UI layout than a DSL built by non-declarative languages.

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

#123

Question: do I read your compiler right, that any line starting with 'var', 'function' or 'this' is assumed to be javascript? So for instance: How will riot.js compile this line? would fail? [Don't mean to sound negative: I've been playing around with my own minimalist framework, so this is right up my alley. I'm reading the code to get a feel for how we've solved problems the same or differently, including the compi…

Not sure but this might indeed fail. Can you place an issue to github? Thanks! Maybe it's good to split HTML and JS with the last HTML tag.

Confirmed. Just take the demo app and insert the line 'this is some text.' anywhere in it. It looks like it's particularly bad if you put it into a nested element: the compiler treats everything after the line (including html markup) as javascript.

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

#124

Question: do I read your compiler right, that any line starting with 'var', 'function' or 'this' is assumed to be javascript? So for instance: How will riot.js compile this line? would fail? [Don't mean to sound negative: I've been playing around with my own minimalist framework, so this is right up my alley. I'm reading the code to get a feel for how we've solved problems the same or differently, including the compi…

Not sure but this might indeed fail. Can you place an issue to github? Thanks! Maybe it's good to split HTML and JS with the last HTML tag.

The compiler also fails if a multi-line comment doesn't end at the end of a line.

   and more text
It outputs an empty compiled file.

My honest opinion is that you should consider rewriting the compiler in a classic tokenize-parse-compile style. Several projects (like mustache.js) have had to go through this evolution. Your current solution -- line-by-line with regexes and state flags -- will only get hairier and hairier.

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

#125

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 vir…

Definitely some similarities exist like you listed. Riot offers following to the (massive) client-side table: 1. Custom tags (with unscary HTML + JS syntax) 2. Minimalism (both size and API surface) 3. Performance (minimizing DOM operations with virtual DOM) The 3rd item is not battle-tested / benchmarked yet and there is probably room for improvements.

I love the differing thought patterns apparent in the length of your and lhorie's response to this question. Like the framework, this response is minimal.

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

#126
post #110

One thing I like React is it is plain javascript. Therefore I can use coffeescript to describe the component: {div, p, ul, li} = React.DOM ... render: -> div className: 'foo', p className: 'bar', 'blabla' p className: 'bar', 'blabla' ul className: 'somelist', @state.items.map (x) -> li key: x.id, x.content If Riot.js uses a custom parser, it may not be able to do this.

Wouldn't this be possible with some preprocessing pipeline?

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

#127
post #50

Great, another framework mixing concerns and doing custom HTML. What's wrong with React?

The point of React is to mix HTML and JS together. They deliberately mix templates with logic, which is actually the main inspiration for Riot. But we felt that what React does could be simplified. We didn't need full diffing and batching of HTML and we didn't like the verbosity on how components are created. minimalism is where Riot starts from.

> The point of React is to mix HTML and JS together.

In React, there are no "templates." There's just JavaScript, and then more JavaScript that looks kind of like HTML (JSX). But it's all still JavaScript.

Also, FWIW, I find that one of the largest benefits of React is to have the logic and the representation of the markup inline, together in the same file. It really helps productivity by eliminating the context switching going from js to markup.

> We didn't need full diffing and batching of HTML

^^^ That's the point of React. You don't have to do the diff in your head (or in your code).

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

#128
I really like what you guys are trying to do. MVP is fantastic and if you get the virtual-dom kind of rendering then it could be it.

I'm planning to evaluate integrating this for flow [1] I've already created a card for it [2]

[1] https://github.com/flow-stack/flow [2] https://trello.com/c/6gwqvq5l/91-riot-integration

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

#129
post #110

One thing I like React is it is plain javascript. Therefore I can use coffeescript to describe the component: {div, p, ul, li} = React.DOM ... render: -> div className: 'foo', p className: 'bar', 'blabla' p className: 'bar', 'blabla' ul className: 'somelist', @state.items.map (x) -> li key: x.id, x.content If Riot.js uses a custom parser, it may not be able to do this.

This no longer works in React 0.12 because they changed the element creation syntax. :\

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

#130

Question: do I read your compiler right, that any line starting with 'var', 'function' or 'this' is assumed to be javascript? So for instance: How will riot.js compile this line? would fail? [Don't mean to sound negative: I've been playing around with my own minimalist framework, so this is right up my alley. I'm reading the code to get a feel for how we've solved problems the same or differently, including the compi…

Not sure but this might indeed fail. Can you place an issue to github? Thanks! Maybe it's good to split HTML and JS with the last HTML tag.

Issues logged for this, the multi-line comment termination issue, and for treating any line that ends with')' or '}' as javascript.
Post reply on HN