[Hyperapp] Render Text with JSX in Hyperapp

Hyperapp is an ultra lightweight (1kb), minimal, functional, JavaScript library for building UIs. It comes with a VDOM engine and state management without any dependencies.

In this lesson, we learn how to use JSX with Hyperapp. By installing a Babel plugin, we can instruct it to transpile JSX to Hyperapp's h method for a better developer experience.

 

install:

npm i -D babel-plugin-transform-react-jsx

 

.babelrc file:

{
  "plugins": [
    ["transform-react-jsx", { "pragma": "h" }]
  ],
  "presets": [
    "env"
  ]
}

 

复制代码
import { h, app } from 'hyperapp'

const view = () => (
  <div>
    <h1>Hyperapp is sweet!</h1>
  </div>
)

const main = app({}, {}, view, document.body)
复制代码

 

posted @   Zhentiw  阅读(234)  评论(0编辑  收藏  举报
编辑推荐:
· SQL Server 2025 AI相关能力初探
· Linux系列:如何用 C#调用 C方法造成内存泄露
· AI与.NET技术实操系列(二):开始使用ML.NET
· 记一次.NET内存居高不下排查解决与启示
· 探究高空视频全景AR技术的实现原理
阅读排行:
· 阿里最新开源QwQ-32B,效果媲美deepseek-r1满血版,部署成本又又又降低了!
· Manus重磅发布:全球首款通用AI代理技术深度解析与实战指南
· 开源Multi-agent AI智能体框架aevatar.ai,欢迎大家贡献代码
· 被坑几百块钱后,我竟然真的恢复了删除的微信聊天记录!
· AI技术革命,工作效率10个最佳AI工具
历史上的今天:
2017-02-07 [NPM] Run npm scripts with git hooks
2017-02-07 [NPM] Use custom config settings in your npm scripts
2017-02-07 [React] Use Jest's Snapshot Testing Feature
2017-02-07 [NPM] Use package.json variables in npm scripts
2017-02-07 [NPM] Run npm scripts when files change with onchange
点击右上角即可分享
微信分享提示