|
|
|
|
|
by capableweb
1474 days ago
|
|
After you get a taste of the free world of hiccup/reagent where it's just vectors and maps to create HTML, its really hard to imagine going back to anything else. Being able to use the same programming language in your "HTML template" (which are just core data structures in a specific shape) as for the rest of your programming is just icing on the top. Small example for people to understand the difference: // HTML & JSX
<div id="person">
<h1>Niko</h1>
</div>
// Hiccup
[:div#person
[:h1 "Niko"]]
|
|
In JSX you might be struggling with expressing certain things, because JS has a statement expression syntax. So you have to circumvent that. In Clojure everything is an expression already.
In JSX you can manipulate components with HoCs. In Clojure it’s just data, no special ceremony needed.
On the client, if you’re using React, you might use hooks to keep travk of state, which are a special construct that don’t exist in JS. In Clojure, if you use something like reagent, you just use atoms, they have a special purpose implementation, but they look and feel like regular old atoms.
However I have to say, JSX and React are very productive even with those limitations, simply because the tooling around it is so good.