Tishx Example (JSX for Browser)
Compiles Tish + JSX to plain JavaScript using Lattish (the lattish package): hooks and createRoot in source; JSX is compiled for you. Vanilla DOM — no Preact, React, or npm UI libraries.
Features Used
- JSX — Only when compiling to JavaScript (
tish build --target js); lowers toh/Fragment(mergelattish) - Lattish — Import
useState,createRoot, etc. fromlattish; the merged bundle includes the JSX runtime.
What It Does
- Compiles
App.tish(with JSX) todist/App.js— self-contained vanilla JS - Stateful form with Lattish
useStatefor name, email, and submit state TextInputandAppcomponents (function components + JSX)
Build
npm install # installs lattish
tish build --target js src/App.tish -o dist/AppOr with tish from the repo:
cargo run -p tishlang--manifest-path ../../Cargo.toml --release --features full -- build --target js src/App.tish -o dist/AppOr use the npm script: npm run build
Run
Open index.html in a browser (requires a local server for ES modules):
python3 -m http.server 8080Then visit http://localhost:8080.
Project Structure
tishx-example/
├── package.json # lattish dependency
├── tish.yaml
├── index.html # Loads App.js (runs on load)
├── src/
│ └── App.tish # Form with stateful components (imports from lattish)
└── dist/ # Generated (gitignored)
└── App.js