Passing `{...rest}` in the html`` tag
https://hono.dev/docs/helpers/html shows how you can use the spread operator to pass a bunch of generic props to a tag, but using JSX.
We're all in on the
html
tagged literal, and I was wondering if its possible to do this using it?
something like: <div ...${rest}>
?html Helper - Hono
Web framework built on Web Standards for Cloudflare Workers, Fastly Compute, Deno, Bun, Vercel, Node.js, and others. Fast, but not only fast.
5 Replies
it's just a string, so it'll behave as any template literal does
you'd need to appropriately stringify + format key/value pairs yourself
gotcha, is there no built-in helper for it?
not the way you mean
you might be able to finesse something w the
jsx
helper, but idk if that's meant for consumer useJsx type in hono is “async () => string” so it’s likely to work. There’s a memo() that sounds like what you want
thanks guys, will check it out tomorrow, will drop an update here in case anyone else is interested