Something went wrong. Try again.
A monorepo of young ideas
Something went wrong. Try again.
1234567891011121314151617181920import "./polyfills.js";import { renderToString } from "react-dom/server";import { components } from "./components.js";
/** * Entry point called from Rust. Exposed as `SSR.render` on the QuickJS global. * * Props cross the FFI boundary as a JSON string; it is cheaper to hand QuickJS * one string and let it parse than to construct the object property-by-property * from Rust. */export function render(componentName, propsJson) { const Component = components[componentName]; if (!Component) { throw new Error(`Unknown component: ${componentName}`); } const props = JSON.parse(propsJson); return renderToString(<Component {...props} />);}