
Company News
Socket Named Top Sales Organization by RepVue
Socket won two 2026 Reppy Awards from RepVue, ranking in the top 5% of all sales orgs. AE Alexandra Lister shares what it's like to grow a sales career here.
snabbdom-jsx-lite
Advanced tools
Write snabbdom templates in .tsx with Typescript or via Babel in .jsx files.
JSX is an XML-like syntax extension to JavaScript (ECMAScript).
Typescript support for JSX supports embedding, type checking, and compiling JSX directly to JavaScript.
Instead of using snabbdom's h (hyperscript function h(tag, data, children)) to define the virtual tree,
with snabbdom-jsx-lite, you get an similar jsx function that is JSX compatible with Babel and Typescript.
Top level props can be any of the the initialized snabbdom modules
such as class, attrs, props, on, style, hooks e.t.c.
Install: yarn add snabbdom-jsx-lite
tsconfig.json
{
"compilerOptions": {
"jsx": "react",
"jsxFactory": "jsx"
}
}
profile.tsx
import {jsx} from 'snabbdom-jsx-lite';
const profile = (
<div>
{/* `sel` is css selector shorthand, <img sel=".profile" /> is same as <img class={profile: true} /> */}
<img sel=".profile" attrs={{src: 'avatar.png'}} />
<h3>{[user.firstName, user.lastName].join(' ')}</h3>
</div>
);
Install: yarn add snabbdom-jsx-lite @babel/plugin-transform-react-jsx
.babelrc
{
"plugins": [
[
"@babel/plugin-transform-react-jsx",
{
"pragma": "jsx",
"pragmaFrag": "Frag"
}
]
]
}
profile.jsx
import {jsx} from 'snabbdom-jsx-lite';
const profile = (
<div>
<img sel=".profile" attrs={{src: 'avatar.png'}} />
<h3>{[user.firstName, user.lastName].join(' ')}</h3>
</div>
);
Fragments let you group a list of children without adding extra nodes to the DOM.
Use jsxFragmentFactory compiler option with Typescript available after version 4.0.0.
{
"compilerOptions": {
"jsx": "react",
"jsxFactory": "jsx",
"jsxFragmentFactory": "null"
}
}
import {jsx} from 'snabbdom-jsx-lite';
const render = () => (
<>
<img sel=".profile" attrs={{src: 'avatar.png'}} />
<h3>{[user.firstName, user.lastName].join(' ')}</h3>
</>
);
A Clock App example is in provided in the repo that uses Functional Components and Fragments. See example/app.tsx
Demo is available at nojvek.github.io/snabbdom-jsx-lite

snabbdom-jsx-lite's jsx function is optimized for performance.
It avoids expensive string manipulation like other snabbdom-jsx libraries.
We test that a million vnodes can be created within 200ms on a github actions virtual core (~2GHz).
See perf.spec.tsx.
These notable third party modules support an optional flattened flavor of jsx.
FAQs
Write snabbdom templates in .jsx or .tsx (JSX for TypeScript)
The npm package snabbdom-jsx-lite receives a total of 2,002 weekly downloads. As such, snabbdom-jsx-lite popularity was classified as popular.
We found that snabbdom-jsx-lite demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 3 open source maintainers collaborating on the project.
Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Company News
Socket won two 2026 Reppy Awards from RepVue, ranking in the top 5% of all sales orgs. AE Alexandra Lister shares what it's like to grow a sales career here.

Security News
NIST will stop enriching most CVEs under a new risk-based model, narrowing the NVD's scope as vulnerability submissions continue to surge.

Company News
/Security News
Socket is an initial recipient of OpenAI's Cybersecurity Grant Program, which commits $10M in API credits to defenders securing open source software.