4 ms·
It's only easier to read because it meets your expectations since it looks "javascripty", but absolutely not as easy to reason about. Both of those snippets ar
by jhall1468 11y ago
It's only easier to read because it meets your expectations since it looks "javascripty", but absolutely not as easy to reason about.
Both of those snippets are intended to generate HTML. In that sense there's no question which one is easier to reason about/read.
- pygy_ 11y agoIt really depends on what you're used to.
- Nemcue 11y agoNot easier to reason about? I would argue the opposite — it is immediately easier to reason about, since I see what functions are called, and I can go look up the documentations for those functions without having to go through a precompile-step.
- omphalos 11y agoYes and additionally (with Chrome's DevTools) you get out-of-the-box functionality like the ability to set a break point, live edit your code right at the breakpoint, and save your change right back to the filesystem. With transpiled languages this kind of workflow is generally less streamlined -- I don't know why more people don't complain about it. The best alternatives I've seen are when people completely reengineer the workflow - I'm thinking about the Elm debugger as an example.
- rch 11y agoThanks - I hadn't even thought about that aspect, but it's definitely a problem I would run into. As popular as React is though, I'd assume there is a browser extension or something to support the workflow.
- mmebane 11y agoIndeed there is: http://facebook.github.io/react/blog/2015/09/02/new-react-developer-tools.html http://facebook.github.io/react/blog/2015/09/02/new-react-de...