Public
Like
2
custom-jsx-runtime-starter
Val Town is a collaborative website to build and scale JavaScript apps.
Deploy APIs, crons, & store data – all from the browser, and deployed in milliseconds.
Viewing readonly version of main branch: v23View latest version
This starter demonstrates how to use a custom JSX runtime in Val Town.
The http.tsx
file is the main entry point and renders an HTML response on the server using React.
This HTML includes a <script>
tag to load the client.tsx
file, which hydrates the React app.
The JSX pragma at the top of files is:
/** @jsxImportSource ./jsx */
This points to the jsx/jsx-runtime
module,
which wraps the default React JSX runtime with a function that extracts an sx
prop and applies it as the style
prop.
When the client module requests the App.tsx
file from Val Town, the JSX is compiled to vanilla JavaScript to run in the browser.