renderToString not work
I have two questions about SSR:
1. It cannot work according to document about renderToString. The browser always plain when the response is a string by renderToString. However, If the response is string that I need not to use renderToString, it works well. The code is following:
import { renderToString } from "solid-js/web";
function Test() {
return <div>Hello World</div>;
}
const server = Bun.serve({
port: 3999,
fetch(request) {
const html = renderToString(() => <Test />);
return new Response(html, {
});
// return new Response("Welcome to Bun!");
},
});
console.log(
2. Is solidStart too complicated to the only purpose for SSR? I just want to change my tiny project from CSR to SSR.
thanks a lot.
1. It cannot work according to document about renderToString. The browser always plain when the response is a string by renderToString. However, If the response is string that I need not to use renderToString, it works well. The code is following:
import { renderToString } from "solid-js/web";
function Test() {
return <div>Hello World</div>;
}
const server = Bun.serve({
port: 3999,
fetch(request) {
const html = renderToString(() => <Test />);
return new Response(html, {
});
// return new Response("Welcome to Bun!");
},
});
console.log(
Listening on localhost:${server.port});2. Is solidStart too complicated to the only purpose for SSR? I just want to change my tiny project from CSR to SSR.
thanks a lot.
