JLarky
JLarky
Explore posts from servers
SSolidJS
Created by JLarky on 10/25/2024 in #support
Uncaught Error: Failed attempt to create new DOM elements during hydration. Check that the libraries
This is my first time trying to create solid component with tsup https://github.com/solidjs-community/tsup-preset-solid and I'm assuming I'm doing something wrong 🙂 I never seen this error message before so I'm at a loss on where to start debugging this 🙂 setup on library side is pretty minimal, here's my index.tsx
import { type Component, createEffect, createSignal } from 'solid-js';
import { generateHydrationScript, hydrate, renderToString } from 'solid-js/web';

export const Hello: Component = () => {
const [counter, setCounter] = createSignal(0);

createEffect(() => {
const interval = setInterval(() => setCounter((c) => c + 1), 1000);
return () => clearInterval(interval);
});

return <div>I want to say hi {counter()}</div>;
};

export function hydrateHello(element: HTMLElement) {
// render(() => <Hello />, element);
return () => hydrate(() => <Hello />, element);
}

export function renderHtml() {
const script = generateHydrationScript();
const html = renderToString(() => <Hello />);
return { script, html };
}
import { type Component, createEffect, createSignal } from 'solid-js';
import { generateHydrationScript, hydrate, renderToString } from 'solid-js/web';

export const Hello: Component = () => {
const [counter, setCounter] = createSignal(0);

createEffect(() => {
const interval = setInterval(() => setCounter((c) => c + 1), 1000);
return () => clearInterval(interval);
});

return <div>I want to say hi {counter()}</div>;
};

export function hydrateHello(element: HTMLElement) {
// render(() => <Hello />, element);
return () => hydrate(() => <Hello />, element);
}

export function renderHtml() {
const script = generateHydrationScript();
const html = renderToString(() => <Hello />);
return { script, html };
}
now on the consumer side I'm trying to call renderHtml and hydrateHello. It seem to be working when my component returns a string (instead of jsx) or if I use render instead of hydrate but the combination of using hydrate and using html template is what is killing it 🫠
32 replies
DDeno
Created by JLarky on 9/7/2023 in #help
Using Deno to run JavaScript from Golang
I just started looking into this, but I'm looking for something like rogchap.com/v8go but it would be cool if I could run Deno instead of v8 So far I'm just thinking of saving some code into a file and then exec.CommandContext with deno run myfile.ts 🙂 any help with how to find any solutions in this area would be appreciated 🙂 so far I only been able to find some experiments in rust like https://austinpoor.com/blog/js-in-rs
5 replies