D
Deno

help

Suggestions for minimal JSX rendering?

MGMark G2/13/2023
Any suggestions for rendering jsx to a string (or ideally a stream), in the most minimal manner from Deno? I'm currently using preact and preact-render-to-string, but i feel that may just be a bit overkill. I don't need client-side, hooks, or any other preact/react features.
MGMark G2/14/2023
nano_jsx didn't seem to be a drop-in replacement, but after a bit of poking around in preact, it doesn't appear to be all that excessive really anyway. And I've managed to par it down to the bare essentials using a minimal preact.js and import map...
{
"compilerOptions": {
"jsx": "react-jsx",
"jsxImportSource": "preact"
},
"imports": {
"preact": "./preact.js",
"preact/": "https://esm.sh/*preact@10.12.1/",
"preact-render-to-string": "https://esm.sh/*preact-render-to-string@5.2.6"
}
}
{
"compilerOptions": {
"jsx": "react-jsx",
"jsxImportSource": "preact"
},
"imports": {
"preact": "./preact.js",
"preact/": "https://esm.sh/*preact@10.12.1/",
"preact-render-to-string": "https://esm.sh/*preact-render-to-string@5.2.6"
}
}
export { createElement as h } from "preact/src/create-element.js";

export const options = {};

export function Fragment(props) {
return props.children;
}
export { createElement as h } from "preact/src/create-element.js";

export const options = {};

export function Fragment(props) {
return props.children;
}
^ ./preact.js this provides just enough for JSX to HTML

Looking for more? Join the community!

Recommended Posts
Deno.run Strange IssueI use `Deno.run` + stdout/signals/etc a lot, but this behavior is beyond my current debugging abilitProperly continuously read data from a ReaderWhat's the proper way to continuously read from a `Deno.Reader`? I'm trying to parse incoming HTTP2npm:redis – everything returns `string`?Every command I try to use from `npm:redis` seems to have inferred return type `string`. Look at theMy magic middlewares typeIf anyone wants a typescript challange here is one: I am trying to create a tuple type which containRead one byte at a time from ReadableStreamWhat would be the most obvious way to read a single byte from a ReadableStream at a time?My deno.lock file exceeds 4000 lines of JSON nowIs this common for application projects? Is there any nice way to clean it up?importing packages breaks typesIm importing `Receiver` from https://deno.land/x/upstash_qstash@v0.3.2. but as soon as i import thisBug report: deno.land website returns a 500 error for JS filesOn https://deno.land, I noticed that the Node vs Deno comparison didn't seem to do anything. From Deno stopps at file.read()I am currently working on a way to communicate with a COM device. I can successfully open and read f[Resolved][Fresh] How to load data asynchronously after rendering a page ?Hi ! I was wondering if someone could help me understand the paradigm to load data asynchronously afSupabase Auth UI in FreshI'm building a simple web. I'd like to use Supabase's Auth UI, namely the `Auth` component, for handAny tool that will complie my TS code to JS?I have coded a website in typescript using Deno, but I want to convert it to JS code. I know the DenHow to get remote IP address when using Deno.serve?I'm using connInfo when using Deno from STD but the native http server doesn't seem to have such intTwo questions on documentationRTFM in 3... 2... 🙂 Question 1: How do i hide documentation for specific exports, i do not want