The instant JSX-to-jQuery transformation engine.
- π Instant - Zero configuration, works out of the box
- β‘ Fast - Leverages Vite's lightning-fast HMR
- π§ jQuery Compatible - Full compatibility with jQuery ecosystem
- π¦ Modular - Component-based architecture with ES6 modules
- π‘ Intuitive - Familiar JSX syntax for jQuery DOM manipulation
- π¨ Flexible - Easy to extend and customize
- π± Responsive - Built-in responsive design support
npm install jqx/** @jsx jCreateElement */
import $ from 'jquery';
import { jCreateElement } from './createElement.js';
const App = () => (
<div className="container">
<h1>Hello JQX!</h1>
<button onClick={() => alert('It works!')}>
Click me
</button>
</div>
);
$('#root').append(<App />);| JQX | React | Vue | Vanilla JS | |
|---|---|---|---|---|
| Bundle Size | ~5kb |
~40kb |
~35kb |
0kb |
| Learning Curve | π Easy | π Medium | π Medium | π Hard |
| jQuery Compatible | β | β | β | β |
| Component Based | β | β | β | β |
/** @jsx jCreateElement */
import { jCreateElement } from './createElement.js';
const Button = ({ text, onClick }) => (
<button className="btn btn-primary" onClick={onClick}>
{text}
</button>
);
export default Button;/** @jsx jCreateElement */
import $ from 'jquery';
import { jCreateElement } from './createElement.js';
let count = 0;
const Counter = () => (
<div className="counter">
<p>Count: <span id="count">{count}</span></p>
<button onClick={() => {
count++;
$('#count').text(count);
}}>
Increment
</button>
</div>
);
export default Counter;/** @jsx jCreateElement */
import $ from 'jquery';
import 'jquery-ui/ui/widgets/draggable';
import { jCreateElement } from './createElement.js';
const DraggableBox = () => {
const handleMount = (element) => {
$(element).draggable();
};
return (
<div
className="draggable-box"
ref={handleMount}
>
Drag me around!
</div>
);
};
export default DraggableBox;jqx/
βββ src/
β βββ components/ # Component files
β β βββ App.jsx # Main application
β β βββ Header.jsx # Navigation header
β β βββ Hero.jsx # Hero section
β β βββ Features.jsx # Features showcase
β β βββ Demo.jsx # Interactive demo
β β βββ Footer.jsx # Page footer
β βββ utils/ # Utility functions
β β βββ appUtils.js # App utilities
β βββ createElement.js # JSX transformation core
β βββ main.jsx # Application entry point
β βββ styles.css # Global styles
βββ index.html # HTML entry
βββ vite.config.js # Vite configuration
βββ package.json # Project configuration
# Install dependencies
npm install
# Start development server
npm run dev
# Build for production
npm run build
# Preview production build
npm run preview
# Run tests
npm testimport { defineConfig } from 'vite';
import react from '@vitejs/plugin-react';
export default defineConfig({
plugins: [
react({
jsxRuntime: 'classic',
babel: {
presets: [['@babel/preset-react', { pragma: 'jCreateElement' }]],
},
}),
],
});Make sure to include the JSX pragma at the top of your components:
/** @jsx jCreateElement */The core function that transforms JSX into jQuery elements.
Parameters:
tag- HTML tag name or component functionprops- Element properties and attributeschildren- Child elements
Returns: jQuery object
| Prop | Type | Description |
|---|---|---|
className |
string | CSS class names |
id |
string | Element ID |
style |
object | Inline styles |
onClick |
function | Click event handler |
onMouseOver |
function | Mouse over event handler |
ref |
function | Element reference callback |
@jqx/router- Client-side routing@jqx/state- State management@jqx/forms- Form handling utilities
We welcome contributions! Please see our Contributing Guide for details.
# Clone the repository
git clone https://github.com/Jeffrey0117/JQX.git
# Install dependencies
cd JQX
npm install
# Start development
npm run devMIT License Β© 2024-PRESENT Jeffrey0117
Made with β€οΈ by the JQX team