Where do I have to call render() for clientside components? #2609
Replies: 2 comments
-
You may run this code on Deno. Deno is local runtime, so If you want to Hono JSX on server-side rendering, you should use JSX helper. If you want to Hono JSX for frontend with Deno, you have to convert TypeScript code to frontend JavaScript code using compiler or framework such as esbuild, Fresh, Vite or other. Ask me about that if your code can't work well. |
Beta Was this translation helpful? Give feedback.
-
@nakasyou JSX helper is what I tried. That is the problem :). |
Beta Was this translation helpful? Give feedback.
-
I am using deno and I had problems importing honos jsx-runtime.
Setting it in deno.json caused
error: pragma cannot be set when runtime is automatic
, because I have to set/** @jsx jsx */
, so that my editor stops screaming at me, that the jsx I write is invalid.deno.json:
Error: Cannot find name 'React'.deno-ts(2304)
I now did it with
import { jsx as _jsx } from "https://deno.land/x/hono@v4.3.1/jsx/dom/jsx-runtime.ts";
. I am not sure if this works properly, because the errorUncaught ReferenceError: document is not defined
says, it doesn't, right?Now to the actual question: Where am I supposed to call render? If I put it at the end of the code I get error:
Uncaught ReferenceError: document is not defined
, because the code is serverside, right? So where do I have to put the render call?I dont really know what to do, the documentation is kind of confusing to me.
Beta Was this translation helpful? Give feedback.
All reactions