How would you pick between Hono + Client Components vs Hono + React (and with or without HonoX)?
I'm using Hono currently along with Datastar, which has been conceptually great but Datastar is just maybe one tick too immature for my current needs.
Hono has been great, so I want to stick with that. Our team knows React reasonably well, so we're leaning that way (and client components would fit just fine), but we're not tied to it.
It seems that we have a few choices:
- use Hono + Client Components
- use Hono + React
- either with or without HonoX
What would you consider the main relevant dimensions to make this choice?
We're a small team if that matters. The site isn't super complex, but some parts definitely benefit from reactivity. In some cases, we solve some problems with custom events + listeners, but in other places, that's not quite enough.
4 Replies
honox is a metaframework, so you'd use it instead of hono + react (or hono + client components)
it's a new framework, so it's still to early for its opinions to be fully validated, imo
two main dimensions are 1) what do you need from the reactivity, and 2) what do your dependencies need
the api for hono client components isn't substantially different to react, so i'd expect you could start w one and migrate to the other pretty easily if you needed more/wanted less
hono client components are pretty lightweight compared to react, which comes w the normal pros + cons
We don't have big dependency needs for the most part, so starting with client components sounds like a good plan, thanks!
Maybe a naive and overly specific question: I see in Yusekebe's repo here: https://github.com/yusukebe/hono-jsx-spa
he "manually" adds the client.tsx page in the vite config, and then adds this script in the renderer. Is there a best-practices way to do this for many pages, or not really, and if that's needed, I should use something more battteries-included than Client Components?
Meaning is there a difference if you have lots of pages in your app vs just a few?
I’d expect not, but I’m just getting started w hono + vite myself
Main difference is the client bundle. HonoX has component islands and only those components will hydrate on the client.
It also effectively splits bundle based on those islands, so you could in theory have an island per page to manage complexity that way
The other main difference is the directory based router. It’s a convention based approach where the framework will set up an instance of Hono with all your pages.
HonoX by itself doesn’t serve any content, at this point you have to bring in either build() or ssg() plugins to actually render webpages.