3 ms·
> I don't think so. Vue places almost it's entire rendering logic into HTML strings. I don't know what this is supposed to mean. The logic in Vue 3 components
by mythz 4y ago
> I don't think so. Vue places almost it's entire rendering logic into HTML strings.
I don't know what this is supposed to mean. The logic in Vue 3 components is maintained in its JavaScript setup function. The template syntax is just HTML based template syntax that can be parsed natively by browser's HTML parsers for binding component functionality to the DOM. Behind the scenes it compiles down to JavaScript functions like React does, where in addition to its template syntax Vue also supports Render Functions [1] and JSX/TSX [2].
The template can be maintained in a string, in the HTML DOM or in a SFC. Templates in a string or DOM don't need a preprocessor whereas Vue SFC's does as compiles down into more optimal JavaScript functions than React's and its template syntax is non-existent at runtime as it never makes it to its compiled .js builds.
Both Vue and React use their view functions to construct a Virtual DOM that they use to calculate which DOM modifications need to be made, i.e. they both serve the same function and their differences is largely cosmetic, effectively just a stylistic preference.
[1] https://vuejs.org/guide/extras/render-function.html https://vuejs.org/guide/extras/render-function.html
[2] https://vuejs.org/guide/extras/render-function.html#jsx-tsx https://vuejs.org/guide/extras/render-function.html#jsx-tsx