← Back to context

Comment by crummy

8 days ago

If you load external content on build (e.g. external blog pages, prices from an external store, etc), then you'll need some way to template that into your HTML. I'm not a huge React fan but I do like JSX compared to other templating languages.

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).

      2 replies →