Quantcast
Channel: ReScript Forum - Latest posts
Viewing all articles
Browse latest Browse all 1969

[RFC] Generic JSX transform

$
0
0

For anyone interested in how the generic JSX transform looks in action, ResX (GitHub - zth/res-x: A ReScript framework for building server-driven web sites and applications. Use familiar tech like JSX and the component model from React, combined with simple server driven client side technologies like HTMX. Built on Bun and Vite.) is now integrated fully with the generic JSX transform. It uses a modified version of Hyperons to render JSX to HTML on the server.

  • It defines a module Hjsx which holds all JSX related things that the transform needs.
  • It also defined a module H that binds to the render-jsx-to-string functions.
  • You then configure rescript.json to use Hjsx as the module, and set up a few relevant open: https://github.com/zth/res-x/blob/main/demo/rescript.json

Viola, now you can use @jsx.component to create JSX components, and use Hjsx.string|int|array etc to render JSX elements.

Side note: It comes with its own custom DOM props with a few interesting bits of “magic” baked in, like HTMX props driven by variants and a custom mini fw for doing simple declarative DOM updates.


Viewing all articles
Browse latest Browse all 1969

Trending Articles