solojsx
TypeScript icon, indicating that this package has built-in type declarations

1.2.9 • Public • Published

alt text

npm npm npm package minimized gzipped size GitHub

  • 🌞 JSX that returns nodes
  • 💎 Supports Attributes & Events
  • 🎉 No Virtual DOM
  • ⚡ Small bundle size (285 B)

Getting started

Using npx

In current folder
npx create-solojsx-app
In new folder
npx create-solojsx-app project-name

Using bun

In current folder
bunx create-solojsx-app-bun
In new folder
bunx create-solojsx-app-bun project-name

Usage

import solojsx from 'solojsx'

const element = (
  <div>
    <h1>SoloJSX</h1>
    <p>SoloJSX is a library that returns nodes from JSX</p>
  </div>
)
document.body.appendChild(element)

Attributes and events

const fun = (text: string) => alert(text)
const e = <div style="color: red" onclick={() => fun("Hi")}>Click Me</div>

Arrays

const e = <div>
    {[1, 2, 3].map(i => <div>{i}</div>)}
</div>

Ternaries

const e = <div>
   {true ? <div>Hello</div> : []}
</div>

Nested elements

const inner = <div>Hello</div>
const e = <div>{inner}</div>

License

MIT

Package Sidebar

Install

npm i solojsx

Weekly Downloads

129

Version

1.2.9

License

MIT

Unpacked Size

4.24 kB

Total Files

5

Last publish

Collaborators

  • jgtools