Setup
Install via NPM
npm i tsx-dom-ssr
You will additionally need some kind of DOM environment if you are running tsx-dom-ssr using node. You can use jsdom or happy-dom for example.
TypeScript Configuration
Enable TSX parsing in your tsconfig.json:
{
"compilerOptions": {
"jsx": "react",
"jsxFactory": "h"
// ...
}
// ...
}
Or with the new JSX Transform:
{
"compilerOptions": {
"jsx": "react-jsx",
"jsxImportSource": "tsx-dom-ssr"
// ...
}
// ...
}
Examples on how to use it will follow.