I think it’s perfectly reasonable to want to use the JSX syntax but not need React. It’s a decent templating language that I bet a lot of people are quite comfortable with.
Here’s a contrived example:
If you were using React, you’d use ReactDOM:
But that’s client-side.
ReactDOM has a way to get it as a string, like:
But notice I need to import React there also in order for that to work. Still, I imagine you could get that running server-side if you needed to.
I was thinking about this after seeing NakedJSX, which does JSX -> HTML without any React dependency. In its case, you put both the JSX and the instructions on rendering it, within the same file, like:
Kinda neat. You could probably build a whole SSG thing out of that.
For me, in the end, if you’re looking to do JSX client side with as little as possible, I’d probably go with Preact (here’s an explanation for how to do it on CodePen if you care, and they also have an SSR method).
And if you’re doing it server-side, I’d probably just go with Astro which easily turns JSX into HTML. I know Next.js can do totally HTML-only builds as well and it seems like Remix can, too, I’ve just never tried it.