import { HtmlEscapedString } from 'hono/utils/html'async function render (c): Promise<HtmlEscapedString> { return c.html(<button>FOO</button>)}
.get('/', async (c) => { return c.html( <BaseLayout> button: {await render(c)} </BaseLayout> )
<form action='?' hx-delete='foo' hx-target='#list'> <ul> {state.foo.map(item => ( <li id={`foo-${item.id}`} key={item.id}> {item.name} ({item.id}) <input type='checkbox' name="foo[]" value={item.id} /> </li> ))} </ul> <button type='submit' name='delete'>Delete Selected</button></form>.delete('/foos', zValidator('form', z.object({ 'foos[]': z.coerce.number().array(), delete: z.string().optional() })), async (c) => { const { 'foos[]': foos } = c.req.valid('form')
.get('/foo', async (c) => { return await c.html(<body/>) })
.get('/bar', async (c) => { return await render(c) }) async function render(c) : Promise<HtlEscapedString> { return await c.html(<body/>) }
.delete('/foo/:id', zValidator('param', z.object({ id: z.number() })), async (c) => { const { id } = c.req.valid('param')
/foo/1