Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

hjsx

Package Overview
Dependencies
Maintainers
1
Versions
19
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

hjsx

![npm](https://img.shields.io/npm/v/hjsx?style=flat-square) ![tests](https://img.shields.io/badge/tests-passing-green?style=for-the-badge)

  • 0.1.16
  • npm
  • Socket score

Version published
Weekly downloads
1
Maintainers
1
Weekly downloads
 
Created
Source

hjsx

npm tests

[!WARNING]
This project is still in early development and is not ready for use.

JSX is great for templating, but pulling in React can be overkill, and even when just using the types it can be confusing. hjsx (Hypertext + JavaScript Extensible Markup Language) aims to provide a simple way to use JSX on the server by rendering it to HTML.

It includes modified types for the JSX elements, with all event handlers removed, and a render method that returns a string.

It is currently available on npm, but I wouldn't recommend using it yet.

Usage

First, install the package:

bun i hjsx

Then you'll need to update your tsconfig.json to use the react-jsx compiler option, and set the jsxFactory and jsxFragmentFactory options to hjsx and hjsx.fragment respectively:

{
    "compilerOptions": {
        "jsx": "react-jsx",
        "jsxFactory": "hjsx",
        "jsxFragmentFactory": "hjsx.fragment"
    }
}

Now you can use JSX in your code:

import { type hjsx } from "hjsx";
type MyComponentProps = hjsx.Attributes & {};
export function MyComponent(props: MyComponentProps) {
    return (
        <>
            <div {...props}>
                <h1>c00l b34nz</h1>
            </div>
        </>
    );
}

Check out the demo:

bun install
bun run examples/serve.ts

Contributing

Contributions are welcome! Please help me. This is a cry for help.

FAQs

Package last updated on 30 Dec 2023

Did you know?

Socket

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.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc