Val Town supports server-rendered JSX. This lets you use JSX syntax to construct your HTML string. It does not include any client-side JSX framework features, such a re-rendering on the client.
To use JSX, you’ll need to insert what TypeScript calls a “per-file pragma” - a comment that uses @jsxImportSource
to specify where the JSX methods are going to come from.
A good default is Preact, which provides a nice preact-render-to-string
module that lets you quickly turn that JSX object into a string that you can use for a response.
https://www.val.town/v/stevekrouse/preactExample
https://www.val.town/v/stevekrouse/reactExample
https://www.val.town/v/stevekrouse/vueExample