r/FlutterDev • • Jan 09 '22

Discussion Can Flutter/Dart replace JavaScript and React? If no, then Why

[removed] — view removed post

43 Upvotes

58 comments sorted by

View all comments

Show parent comments

1

u/[deleted] Jan 09 '22

JSX is compiled, so the argument that Dart doesn't work because it's compiled is the same as JSX, no one uses React without some form of compiler anyway.

0

u/miyoyo Jan 10 '22

That's kind of disingenuous, React's JSX is not going to majorly affect the final code, its effectively just converted to create Elements, whereas Dart brings entirely new semantics, different runtime type checks, and more, that's like saying an airplane and a shopping cart are the same because they both have wheels.

1

u/[deleted] Jan 10 '22 edited Jan 10 '22

That is not a great straw man argument. It misses the entire point that it's not comparing whether or not a base compiler is needed. It is fact that JSX does, regardless of how much it actually does. No one cares about the additional checks that dart2js will add when compiling dart, as it in no way changes the actual functionality of javascript as a language, so there is no point in comparing how much each actually changes, except for the difference in it needing to exist at all, or not.

To prove the point further, people don't even just use a jsx "compiler", they use babel, with like 50 plugins installed, that does hundreds of polyfills, manipulations, checks, and TypeScript or whatever else you want to support.

-3

u/miyoyo Jan 10 '22

The amplitude of change, and the resulting performance hits, are definitely things to consider, "compiled" JS is pretty much still the same, and acts similar to the original source, whereas Dart compiled to JS effectively runs into a VM written in JS, you can't just pretend that these are equivalent.

3

u/[deleted] Jan 10 '22

Except if you had done just a little research into what you’re saying instead of pulling stuff out your arse, you’d know that there isn’t really a Dart VM in browsers, nor does Dart itself run directly in a browser. Dart code gets compiled into optimized JavaScript, which in turn means that you’re still running JavaScript.