0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

HonoX入門

Posted at
$ mkdir honox_test
$ cd honox_test
$ npm install hono honox
$ npm create hono@latest .
create-hono version 0.14.3
✔ Using target directory … .
? Which template do you want to use?
  nextjs
  nodejs
  vercel
❯ x-basic
  aws-lambda
  bun
  cloudflare-pages
? Which template do you want to use? x-basic
? Directory not empty. Continue? (y/N) y
? Directory not empty. Continue? yes
? Do you want to install project dependencies? (Y/n) 
? Do you want to install project dependencies? yes
? Which package manager do you want to use? (Use arrow keys)
❯ npm
? Which package manager do you want to use? npm
$ npm run dev

image.png

image.png

index.tsxは以下のようになっているため。

app/routes/index.tsx
import { css } from 'hono/css'
import { createRoute } from 'honox/factory'
import Counter from '../islands/counter'

const className = css`
  font-family: sans-serif;
`

export default createRoute((c) => {
  const name = c.req.query('name') ?? 'Hono'
  return c.render(
    <div class={className}>
      <h1>Hello, {name}!</h1>
      <Counter />
    </div>,
    { title: name }
  )
})
0
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?