Ranter
Join devRant
Do all the things like
++ or -- rants, post your own rants, comment on others' rants and build your customized dev avatar
Sign Up
Pipeless API
From the creators of devRant, Pipeless lets you power real-time personalized recommendations and activity feeds using a simple API
Learn More
Comments
-
I mean, look at this simple if statement for conditional rendering:
{someLogic &&
<p> some text </p>
}
And some people even use (nested) ternary operators for that stuff. Luckely my job is about refactoring -
It gets so nasty, so quickly
I mean, look at the VueJS syntax :(
Maybe it's better in a nice templating language like Slim -
Voxera115857y@wildebeest ok I agree, that is not very easy to read and yes, other frameworks can have nicer syntax but react together with jsx or tsx template format is in my opinion easier and cleaner than vue’s v-... attributes.
This example can be written in lots of better ways, You would wrap it into a conditional element or use a simple if statement around it which reads easier than even vue’s v-if=“...” .
But that might be just personal preferences. -
@Voxera it's time for me to continue reading the react docs and find some noce thing online, because I understand the readability depends on my skill? :-)
-
Voxera115857y@wildebeest well. The example you listed was not very well done. Yes it was compact and for someone with lots of experience with boolean expressions in js it was probably readable but personally I know it is used in googles js compiler and minifier ;) and that was not designed to write readable code.
I prefer a bit more verbose but readable code.
Thats also why I dislike the attribute way of vue, you have to escape any complex expression to prevent breaking the attribute.
React with jsx or tsx does not have that problem and reads more like normal javascript and html but without most escaping ;)
Related Rants
Oh come on. Even the docs itself are a parody on the framework
rant
reactjs