htm

编程之家收集整理的这个编程导航主要介绍了htm编程之家,现在分享给大家,也给大家做个参考。

htm 介绍

htm 实际上将jsX风格的语法更进一步!htm适用于大多数Virtual DOM库 .

npm安装:

npm i htm

import htm from 'https://unpkg.com/htm?module'

const html = htm.bind(react.createElement);

// just want htm + preact in a single file? there's a highly-optimized version of that:

import { html,render } from 'https://unpkg.com/htm/preact/standalone.mjs'

例子:

<!DOCTYPE html>

<html lang="en">

<title>htm Demo</title>

<script type="module">

import { html,Component,render } from 'https://unpkg.com/htm/preact/standalone.mjs';

class App extends Component {

addTodo() {

const { todos = [] } = this.state;

this.setState({ todos: todos.concat(`Item ${todos.length}`) });

}

render({ page },{ todos = [] }) {

return html`

<div class="app">

<${Header} name="ToDo's (${page})" />

<ul>

${todos.map(todo => html`

<li>${todo}</li>

`)}

</ul>

<button onClick=${() => this.addTodo()}>Add Todo</button>

<${Footer}>footer content here<//>

</div>

`;

}

}

const Header = ({ name }) => html`<h1>${name} List</h1>`

const Footer = props => html`<footer ...${props} />`

render(html`<${App} page="All" />`,document.body);

</script>

</html>

GitHub:https://github.com/developit/htm

网站描述:使用标准标记模板的 JSX 替代方案

htm

官方网站:

小编说

以上是编程之家为你收集整理的htm全部内容。

如果觉得编程之家网站内容还不错,欢迎将编程之家推荐给好友。

版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。

相关推荐


jade,Jade 是一个高性能的模板引擎,以 JavaScript 的形式集成在 node 和浏览器中
curl.js,轻量级,快速,可扩展的模块加载
jspm-cli,基于SystemJS的Js包管理器
angular-cli,快速构建Angular2项目
lerna,一款多项目多模块的管理工具
duo.js,前端的下一代包管理器。
WebJars,将web前端资源(如jQuery &amp; Bootstrap)打成jar包文件
swc,用rust编写的网络编译器,babel的替代品
fetch,ajax请求的新写法
babel-plugin-preval,在构建期预先评估代码
Lebab,用于将你的ES5代码转成ES6/ES7
browserify,一个浏览器端代码模块化工具,require和module.exports来导入和导出.Browserify的原理:部署时处理代码依赖,将模块打包为一个文件。
esprima,高性能,符合标准的ECMAScript 解析器
bundle-buddy,识别bundle重复的工具
FIS3,为你定制的前端工程构建工具
prerender-loader,Webpack通用预渲染
Parcel,快速,零配置的 Web 应用程序打包器
Neutrino,创建和构建零初始配置的现代JavaScript应用程序
lit-html,js中写 HTML 的模板引擎
walle,瓦力 Devops开源项目代码部署平台