This post is simply my take on the primeagen's video.
The video's TLDR is that a good templating engine doesn't require you to add extra effort to enable writing html using the language you're comfortable with and that JSX will handle things differently than other libraries such as Solid.js and ties to the DOM.
Well, the reason why I disagree with such claim is that these claims are based on the fact that all developers want simplicity. But simplicity has a cost. The cost could be development time, convenience, adaptation, etc.
You cannot claim that JSX does things differently than Solid and then state that it's an issue. Solid came in like 9 years after react. It doesn't make sense to ask why JSX doesn't work the same way Solid does.
There was also a claim about simplicity of writing code in the language you already use. Well, if you are writing templating into HTML, you already need to know HTML. You had to learn the syntax for the templating engine (which there are many). You already had to go through the inconvenience of learning some new syntax at some point. Don't forget that you still have to work with css or any of its flavors to get the look and feel you strive for. Why doesn't css get as much hate from the community as javascript? Will you be able to embed LESS code into SCSS code? No you won't.
There is also another important argument regarding templating in general. I have no issue with templating what so ever, but I do have an issue with the hate on javascript and jsx. Yes you do have to maintain state. Yes you do have to write javascript in a html like format. Yes you need to deal with responsiveness. But these are all part of the natural evolution of writing code for the browser. Imagine having to deal with state when you are requesting a template from the server.
I have gone through the docs of something like htmx which seems like a really nice solution but I quickly realized that many of the complexities that I can easily solve with a state or with a reducer are going to be a nightmare for me to handle if I am building it with a template.
There is also the issue with server load and transfers. If I have to ask the server to send me the entire HTML for every change that I make, there is a ridiculous amount of unnecessary data that is being transferred between the client and server. And it also serves as a bottleneck and a choking point during traffic spikes. It is much simpler to rely on a CDN or a server to deliver a piece of javascript that will consume a simple REST API endpoint or a GraphQL with an array of just the needed data and let javascript handle it. Image having to draw a chart and/or render a table with a 100 different entires and 10 columns... for each. single. user. And then send it to the client.
State isn't the only issue anymore.
In a nutshell, as someone who works with javascript AND golang at the same time, as someone who tried different libraries and frameworks, as someone who fell in love with javascript and its community after trying over 10 different languages, as someone who appreciates the power of writing javascript on the backend knowing very well that there are better options but likes the convenience... let's stop the hate on javascript. Let's appreciate the fact that the community is growing and giving us something like typescript. Let's appreciate that with our current state, we are able to introduce more and more people to the industry with a low barrier to entry and allowing them to grow at their own pace. Let us appreciate all the good that javascript has given us.
Top comments (0)