JSX

Provides a slim JSX implementation for scripting

Technology

The jsx module provides a lightweight JSX implementation for Project Forge applications. It enables developers to write TypeScript-based client-side code using familiar JSX syntax without the overhead of React or other heavy frameworks.

Overview

This module delivers a minimal, performance-focused JSX implementation that:

Key Features

Performance

Developer Experience

Functionality

Implementation Details

Core JSX Function

The module exports a single JSX function that: - Creates DOM elements from JSX syntax - Handles attribute mapping and normalization - Manages child element insertion and text nodes - Provides comprehensive error checking

Attribute Handling

Child Management

Usage Example

 1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
import { JSX } from "./jsx";

// Create a simple element
const button = <button className="btn primary" onClick={handleClick}>
Click Me
</button>;

// Create with dynamic content
const list = (
<ul className="items">
{items.map(item => (
<li key={item.id}>{item.name}</li>
))}
</ul>
);

// Raw HTML injection
const content = (
<div dangerouslySetInnerHTML={{__html: htmlString}} />
);

Package Structure

Client Code

Source Code

See Also