DEV Community

Discussion on: Why I Converted from Vue to React

Collapse
 
anuraghazra profile image
Anurag Hazra

Hi Paulo, can you clarify why do you think JSX is the only read black magic in the entire js ecosystem? i'm planning to write a article about JSX so i wanted to know your opinions. why JSX is black magic to you?

Collapse
 
pauloevpr profile image
Paulo Souza

Black magic is not the right wording. What I mean is that JSX is not standard. If you look at Vue, it is essentially standard Javascript and HTML (with custom attributes) that can be understood by any web developer. JSX on the other hand is this weird and unfriendly mix of HTML and Javascript in the same code block.

There is nothing wrong with having custom syntax that requires a compilation step. Typescript falls into the same category, and I love it. I just don't like JSX cause it looks terribly ugly.

Thread Thread
 
anuraghazra profile image
Anurag Hazra • Edited

Okay let me go line by line and give my opinions :)

"What I mean is that JSX is not standard" ?? facebook.github.io/jsx/

"If you look at Vue, it is essentially standard Javascript and HTML (with custom attributes)" - i don't think vue, sevlte, or angular's templates are in any ways valid html markup

"that can be understood by any web developer" - JSX is way simpler to understand than vue's template, if i ask you "how does Vue's v-for directive work" can you answer it in simple words? but if i ask you "How does jsx loops works" i can tell you the answer "JSX is javascript so we can just use Array.map to map out the childrens directly in the template"

"JSX on the other hand is this weird and unfriendly mix of HTML and Javascript in the same code block." - JSX isn't a mix of HTML or js its Just javascript. it represents Tree like structures and we use it to build up the virtual dom.

"I just don't like JSX cause it looks terribly ugly." - well, personal preference :D

That's all. :)

Thread Thread
 
pauloevpr profile image
Paulo Souza • Edited

Needless to say it all comes down to preference since you could use any of these frameworks to build most web apps.

JSX is not just Javascript since it has markup in it and there is special syntax to separate markup from the actual js code. If it were just Javascript, it wouldn't need a special compiler in the first place. This is more than obvious.

Anyway, tools are just tools. Languages are just languages. Pick whatever gets the job done.

Javascript will die some die, just like Vue and React will die too, just like the almighty Jquery is dying just now.

As a developer, what matters to me is to spend my time getting the job done rather than advocating in favor of a particular framework.

Btw, I develop frontends using Angular, React, Vue, XAML, Blazor and vanilla javascript/html. As I said, they are nothing more than tools.