(no title)
fleshweasel | 9 years ago
I also am strongly against string references to model properties in your template. Again, it's much better to use tools that provide some static validation of what you're doing.
Give me React with TypeScript to help me make sure I'm passing around what I said I'm expecting to receive at each point as features are changed and added, and I'll be in business.
Honestly, I use React in spite of my opinion of Facebook.
duncanawoods|9 years ago
I much prefer react with standard functions e.g.
You can use an API like this in every language without any hacks. It doesn't hurt readability or productivity and it has normal expression evaluation semantics. JSX isn't syntactic sugar, its a gross "syntactic artificial flavour" because it doesn't make the syntax easier, it just makes it look something a bit like HTML but with dozens of subtle differences e.g. attribute names, attributes values, tag closing rules, special extensions etc.scrollaway|9 years ago
JSX is well defined and does not support any of HTML's looseness. It's predictable. It makes the code easier to follow. And if you don't want to use it, you don't have to. I see no issue.
peterhunt|9 years ago
treehau5|9 years ago
When unobtrusive javascript became a thing.
> As an industry, we’ve already decided: HTML and JavaScript belong together.
https://medium.com/@housecor/react-s-jsx-the-other-side-of-t...
keymone|9 years ago
spyder|9 years ago
hashkb|9 years ago
dustingetz|9 years ago
j_r_f|9 years ago
The argument that DOM.div() is more readable than <div/> is honestly hilarious to me. Any non-trivial tag structure will be unnecessarily complicated through the API. Especially when you can just write it almost exactly how it's going to look when it becomes HTML in JSX.
steinuil|9 years ago
fleshweasel|9 years ago
Unbeliever69|9 years ago
jasim|9 years ago
The HTML snippet embedded in `let titleView = "<h1>Hello</h1>"` can only be parsed as a string. This means no tooling support - no linting, no tags that autoclose, no code formatting. But if you have a distinct syntax for XML, the parser can clearly figure out what the strings are, and what the tags are.
First class support for XML is, after using JSX, just so obvious in hindsight if you're building anything to do with the web.
Cyph0n|9 years ago
Existenceblinks|9 years ago
Mounting, unmounting, rendering, props receiving, updating etc, these callbacks' calling orders open to bad rendering practice(e.g. unnecessary render, unexpected calls), that's why people avoid putting logics in there. It claims to be self-contained but parent-child communication breaks it in several ways, I am not a big fan of HOC.
People claim the simple of "just a view layer" of react, I don't think so. I haven't tried vuejs, but it seems like it takes care of most rendering callbacks/component communication seamlessly.
lojack|9 years ago
I think you'll find that most react developers advise against doing parent-child communication in react components for all but the simplest cases. Does it involve writing higher order components? Probably. Curious, why aren't you a big fan of them?
fleshweasel|9 years ago
I haven't written any higher order components myself, unless you consider parameterizing event handlers in props to be higher order.
k__|9 years ago
"Good view layer code means that templates should be as declarative as possible, NOT that the view layer as a whole should avoid procedural logic altogether." - https://lhorie.github.io/mithril-blog/getting-over-a-fear-of...
neikos|9 years ago
[1]: https://github.com/developit/preact
savitur_it|9 years ago
chiefalchemist|9 years ago
rk06|9 years ago