DEV Community

Discussion on: Some cool JavaScript Shorthand that will make your code cleaner than your peer's

 
vitiok78 profile image
Victor Cozhuhari • Edited

It is exactly one of the many reasons why I prefer Vue over React. That ugly JSX mess that mixes JavaScript logic and kinda HTML markup is awful. Separate template engine is always better. Other languages figured it out long time ago. Even in PHP they prefer to use Twig rather than mixed mess.

Vue:

<div>
    <div v-if="response.isLoading">Loading...</div>
    <div v-else-if="response.isError">{{ response.error.message }}</div>
    <div v-else>{{ repsonse.data }}</div>
</div>
Enter fullscreen mode Exit fullscreen mode

P.S. BTW else-if and else look natural and clean in template but they are bad inside JavaScript code at the same time

Thread Thread
 
jonrandy profile image
Jon Randy 🎖️

JSX is an abomination - makes me want to vomit every time I see it 🤮