/Wiki/sources/honojs__hono/2026/https-hono-dev-llms-full-txt-function-based-opti-f1a85548305f-function-based-options-s0240-c0000.md

Function-based Options (1) - hono-docs

Function based Options (1) Source evidence: /Sources/raw/honojs hono/honojs hono.md Canonical citation: https://hono.dev/llms full.txt function based options...

Function-based Options (1)

Source evidence: /Sources/raw/honojshono/honojshono.md Canonical citation: https://hono.dev/llms-full.txt#function-based-options

Summary

You can pass a function that receives a Context object instead of a static options object. This allows you to dynamically set options based on the request context, such as environment variables or request parameters. ```tsx app.use( '*...

Content

You can pass a function that receives a Context object instead of a static options object. This allows you to dynamically set options based on the request context, such as environment variables or request parameters.

app.use(
  '*',
  jsxRenderer(
    ({ children }) => {
      return (
        <html>
          <body>{children}</body>
        </html>
      )
    },
    (c) => ({
      stream: c.req.header('X-Enable-Streaming') === 'true',
    })
  )
)

As a concrete example, you can use this to disable streaming when generating static sites (SSG) with <Suspense>, by using the isSSGContext helper:

Kinic Wiki
Loading knowledge node
Details

Identity

database
db_23dhmsxlhukv
database_id
db_23dhmsxlhukv
path
/Wiki/sources/honojs__hono/2026/https-hono-dev-llms-full-txt-function-based-opti-f1a85548305f-function-based-options-s0240-c0000.md
kind
directory
role
markdown_note
children
0

Metadata

created_at
virtual
updated_at
virtual
etag
virtual
metadata_json
{}

Lint Hints

No lightweight warnings.

Outgoing Links

No outgoing links indexed.

Incoming Links

Select a file node to inspect backlinks.

Raw Source

No raw source path inferred.