Hacker News new | ask | show | jobs
by dmitriid 2628 days ago
React is pure JS, no string parsing is involved at runtime (JSX is just function calls [1]).

Vue has its own templating language that gets compiled to function calls that are very similar to React’s [2]. I have my fair share of criticisms against Vue (as any templating system, it’s quite inconsistent[3]).

I don’t think any of them just dump string blobs via innerHtml. And I doubt any of them parse strings with regexps at runtime.

[1] https://reactjs.org/docs/react-without-jsx.html and https://overreacted.io/react-as-a-ui-runtime/ (specifically section on React elements)

[2] https://vuejs-tips.github.io/compiler/#v-else

[3] https://news.ycombinator.com/item?id=19199423

1 comments

> React is pure JS, no string parsing is involved at runtime (JSX is just function calls [1]).

Why does this matter? React still eventually compiles down to DOM operations whether that be innerHTML or XML modifications.

To quote stevebmark [1]

--- quote ---

…we’ve learned not to write code in strings. You’d think this would be a fundamental law of software engineering

Writing code, not strings, means you can do everything to it that you can do to code. You can type check code. You can lint it. You can optimize it, compile it, validate it, syntax highlight it, format it with tools like Prettier, tree shake it…

--- end quote ---

https://news.ycombinator.com/item?id=18511943