SolidJSS
SolidJSβ€’12mo agoβ€’
2 replies
NaughtyShiba

Client-only API called on the server side.

There's this one nice library which can bundle MDX as a JSX Component. Thanks to _jsx_runtime it's easy-ish to adapt it from react-only to other JSX supporting libraries. (https://github.com/kentcdodds/mdx-bundler)

I've managed to nail it down for some of the libraries, unfortunately I'm stuck with Solid's one, and I'm not that familiar with Solid (https://github.com/kentcdodds/mdx-bundler/pull/236)

I've

import * as SolidH from "solid-js/h"; (_jsx_runtime is imported from there?

/** @param {JSX.HTMLAttributes<HTMLSpanElement>} props */
const SpanBold = ({children}) => {
  return SolidH.default('span', { class: "strong" }, children)
}

const res = SolidH.default(SpanBold, {children: "hello"});


And I receive
Client-only API called on the server side. Run client-only code in onMount, or conditionally run client-only component with <Show>.

From what I manged to figure out about SSR (from outputs), build creates string[] which is then SSR'ed. Basically, behaves quite more different than other JSX libs (preact, react, hono, vue) especially on Server Side?
GitHub
🦀 Give me MDX/TSX strings and I'll give you back a component you can render. Supports imports! - kentcdodds/mdx-bundler
GitHub - kentcdodds/mdx-bundler: 🦀 Give me MDX/TSX strings and I'll...
GitHub
What:
Support JSX runtimes other than react.
Why:
Allow this to be used with other JSX runtimes supported by mdxjs (https://mdxjs.com/docs/getting-started/#jsx) but not limited to. For example, thi...
Was this page helpful?