/hono-scripts-demo

Using JSX components to use Hono Server Side Rendered data.

Primary LanguageTypeScript

Hono Client Side JavaScript Demo

In the Hono Discord server, "Stoke" asked about how to use query parameters in his client side JavaScript.

In this demo, I show two ways to enable this:

  1. Using the Hono html helper to have the JavaScript inline with HTML.
  2. Creating JSX components to separate the JavaScript into separate files.

This screen recording will demonstrate both approaches. Sorry, I wasn't able to cleanup the video.

To see code changes, see each of these commits.

  1. Initial Hono Cloudflare Pages template.
  2. Simple inline html sample
  3. Using JSX Components
  • NOTE: In the video, I did not go over the changes to the tsconfig.json file.
    • strict was disabled because the original poster seemed to prefer plain JavaScript.
    • lib was changed so TypeScript would recognize document and other browser APIs.

Development Setup

npm install
npm run dev