← Back to context

Comment by notpushkin

7 days ago

Then use JSX without React?

What do you mean?

JSX compiles to jsx(“div”, props, children) function calls so you need a runtime (which can be small) to render that into strings.

At which point, who cares if you’re using react to do it? It’s a good zero dep implementation of a jsx fn.

  • Yeah, but this function needn’t run in the browser. Just generate HTML with it and save into a file! (I don’t have a link to npm handy, but I’m sure there’s a library that can do that already.)

    Alternatively, you can use Astro with React components, which will render them using React-DOM, but save them as static HTML by default (you can still choose some components to be hydrated, though).

    • The article in question is specifically about using Next.js to do what you are saying (generate static HTML files from a set of React components). He also mentions using Astro for it.

      1 reply →