[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 ...
随机推荐
- [SQL]选取随机行
在sql server中语句如下: select top 10 * from recordTable order by NEWID();
- FZU Problem 1853 Number Deletion
Problem 1853 Number Deletion Accept: 80 Submit: 239 Time Limit: 1000 mSec Memory Limit : 32768 ...
- _DataStructure_C_Impl:AOE网的关键路径
//_DataStructure_C_Impl:CriticalPath #include<stdio.h> #include<stdlib.h> #include<st ...
- Geeks - Range Minimum Query RMQ范围最小值查询
使用线段树预处理.能够使得查询RMQ时间效率在O(lgn). 线段树是记录某范围内的最小值. 标准的线段树应用. Geeks上仅仅有两道线段树的题目了.并且没有讲到pushUp和pushDown操作. ...
- angularjs1-8,cacheFactory,sce
<!DOCTYPE HTML> <html ng-app="myApp"> <head> <meta http-equiv="C ...
- [IOI 1999] 花店橱窗布置
[题目链接] https://www.luogu.org/problemnew/show/P1854v [算法] f[i][j]表示放了前i束花,第i束花放在第j个花瓶中,所能获得的最大美学值 由于要 ...
- 2017-3-7 leetcode 66 119 121
今天纠结了一整天============================================================== leetcode66 https://leetcode.c ...
- .NET序列化工具Jil、Json.NET和Protobuf的简单测评
前一段时间逛园子的时候发现有人比较了Jil.Json.NET和Protobuf的性能,一时好奇,也做了个测试,这里记录下来,以供查阅. 前期准备 依赖类库的话,可以通过Nuget在公共组件库总下载,这 ...
- POJ 1543 暴搜
题意:输出a^3=b^3+c^3+d^3的所有a,b,c,d的值. b,c,d由小到大且b,c,d都大于1. 思路: 按照题意写就好.... // by SiriusRen #include < ...
- 源码编译Oprofile
上菜了翠花:首先编译Oprofile需要三个源码:binutils.popt与oprofile Linux版(由于是在64位的linux系统编译-----敬请参考“在64位linux上编译32位程序” ...