[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)
[Hyperapp] Render Text with JSX in Hyperapp的更多相关文章
- Vue.js 2.x render 渲染函数 & JSX
Vue.js 2.x render 渲染函数 & JSX Vue绝大多数情况下使用template创建 HTML.但是比如一些重复性比较高的场景,需要运用 JavaScript 的完全编程能力 ...
- vue render函数使用jsx语法 可以使用v-model语法 vuex实现数据持久化
render函数使用jsx语法: 安装插件 transform-vue-jsx 可以使用v-model语法安装插件 jsx-v-model .babelrc文件配置: vuex实现数据持久化 安装插 ...
- [React] Render Text Only Components in React 16
In this session we create a comment component to explore how to create components that only render t ...
- render函数之jsx应用
一.模板缺陷(模板的最大特点是扩展难度大,不易扩展.可能会造成逻辑冗余) <level :type="1">哈哈</level> <level :ty ...
- 学习 React(jsx语法) + es2015 + babel + webpack
视频学习地址: http://www.jtthink.com/course/play/575 官方地址 https://facebook.github.io/react/ 神坑: 1.每次this.s ...
- 在vue中使用jsx语法
什么是JSX? JSX就是Javascript和XML结合的一种格式.React发明了JSX,利用HTML语法来创建虚拟DOM.当遇到<,JSX就当HTML解析,遇到{就当JavaScript解 ...
- React实践debug:JSX输出的限制(存疑)
今天在练习React构建组件的时候遇到一个问题. 由于文档中反复提倡将组件尽可能按功能单位分解复用.在练习用React做一个todolist时候,我把todolist分解成两部分: class Tod ...
- vue中使用jsx
vue中使用jsx 为什么需要使用jsx呢?这个需要搞清楚 其实vue官方也说了,对于那些非常多v-if v-else的情况,就可以尝试使用render函数或者jsx,不过render函数写简单的结构 ...
- Multi-line NSAttributedString with truncated text
http://stackoverflow.com/questions/7611816/multi-line-nsattributedstring-with-truncated-text/1017279 ...
随机推荐
- [asp.net]ashx中session存入,aspx为null的原因(使用flash uploader)
I am using uploadify to upload files, they automatically post to the handler. I then modify the sess ...
- Android 开发最佳实践
原文地址:https://github.com/futurice/android-best-practices/blob/master/translations/Chinese/README.cn.m ...
- UML期末绘图及细节总结
往届期末绘图的题目例如以下所看到的: Read the providing materials carefully, and then do tasks. 2.1: Use Case Diagram ...
- VC版超级记事本
这是学习VC时的一个大作业,超级记事本.突然发现了,传上来供大家学习參考! 一. 功能需求: 1. 能在原有像记事本程序的基础上加入很多其它功能: 1).可以改变背景颜色. 2).可以改变字体颜色. ...
- [C#] 怎样分析stackoverflow等clr错误
有时候由于无限递归调用等代码错误,w3wp.exe会报错退出.原因是clr.exe出错了. 这样的错误比較难分析,由于C#代码抓不住StackOverflowException等异常. 处理方法是:生 ...
- 【C++】String类中的运算符重载
模块化设计: 头文件: <span style="font-size:18px;"> #ifndef operator_operator_h #define opera ...
- android:padding 与 android:margin的差别
android:padding Padding 为内边框,指该控件内部内容,如文本/图片距离该控件的边距 android:margin Margin 为外边框,指该控件距离边父控件的边距
- asp.net website 单独编译某个页面,连带编译app_code
选中某一个页面,然后右键build page
- C#比较二个数组并找出相同或不同元素的方法
这篇文章主要介绍了C#比较二个数组并找出相同或不同元素的方法,涉及C#针对数组的交集.补集等集合操作相关技巧,非常简单实用, 具有一定参考借鉴价值,需要的朋友可以参考下 " }; " ...
- 用Latex做介绍自己和团队科研的网页
最近实验室师妹用网上的一些模板改了改做了几个网页.感觉还可以.但是实际上总觉得好像和韩家炜.周志华他们的页面差点什么. 最近找论文时发现奥地利的hornik老先生页面居然latex做的,然后找到了下面 ...