[PReact] Create a Hello World App with Preact
By creating a simple ‘hello world’ example application first in vanilla Javascript, and then in Preact without any tools, we’ll learn what type of problems Preact is solving for us and how is works at a low level. Then we’ll switch to a Webpack + Babel setup we’ll cover some fundamental concepts such as, which imports we need, how to create a component, how to use JSX and finally how to render our component into a target element in a web page.
index.js
import {h, render} from 'preact';
import App from './components/App'; render(<App />, document.querySelector('main'));
Here, we must import 'h' even we don't use it. It allows preact convert JSX to JS render to the DOM.
App.js:
import {h} from 'preact'; const App = () => {
return (
<div>
Hello World!!!
</div>
);
}; export default App;
[PReact] Create a Hello World App with Preact的更多相关文章
- How to create a Maven web app and deploy to Tomcat - fast
原文地址: http://www.blogjava.net/sealyu/archive/2010/01/08/308706.html Procedure Prerequisites and Assu ...
- [PReact] Reduce the Size of a React App in Two Lines with preact-compat
Not every app is greenfield, and it would be a shame if existing React apps could not benefit from t ...
- Create Fiori List App Report with ABAP CDS view – PART 2
In the Part 1 blog, we have discussed below topics CDS annotations for Fiori List Report. How to cre ...
- Create Fiori List App Report with ABAP CDS view – PART 1
From Create Fiori List App Report with ABAP CDS view – PART 1 In this blog, I am going to show How C ...
- mvn archetype:create报错解决办法
执行下列命令:mvn archetype:create -DgroupId=com.mycompany.app -DartifactId=my-app -X 会报错: 此时将archetype:cr ...
- 404 & 401 Errors with the App Management Service
from:http://blogs.technet.com/b/sharepoint_-_inside_the_lines/archive/2013/06/23/404-amp-401-errors- ...
- In App Purchase Statuses
In App Purchase StatusesThe following are the available states that can be assigned to your in app p ...
- iphone Dev 开发实例9:Create Grid Layout Using UICollectionView in iOS 6
In this tutorial, we will build a simple app to display a collection of recipe photos in grid layout ...
- [转] Creating a Simple RESTful Web App with Node.js, Express, and MongoDB
You can find/fork the sample project on GitHub Hey! This and all my other tutorials will soon be mov ...
随机推荐
- HDU 4678 Mine SG博弈
http://acm.hdu.edu.cn/showproblem.php?pid=4678 自己太蠢...没学SG...还是浩神指点我SG精髓以后才A的这题...(第一题SG 这里子游戏之间没有影响 ...
- vmstat---有关进程、虚存、页面交换空间及 CPU信息
虚拟内存运行原理 在系统中运行的每个进程都需要使用到内存,但不是每个进程都需要每时每刻使用系统分配的内存空间.当系统运行所需内存超过实际的物理内存,内核会释放某些进程所占用但未使用的部分或所有物理内存 ...
- HDU 1495 很可乐(BFS 倒水问题)
题意 将体积为s的可乐 利用容积分别为n和m的两个杯子平均分为两份 至少须要倒多少次可乐 能够把容器s,n,m中装的可乐量看成一种状态 容器都是没有刻度的 所以每次倒可乐要么把自己倒完 要么把 ...
- 自定义控件学习——下拉刷新ListView
效果 开始用Android Studio写了,还有挺多不明白这IDE用法的地方....蛋疼 主要思路 1. 添加了自定义的头布局 2. 默认让头布局隐藏setPadding.设置 -自身的高度 ...
- Swagger文档转Word
Swagger文档转Word 文档 GitHub 地址:https://github.com/JMCuixy/SwaggerToWord/tree/developer 原创作品,转载请注明出处:h ...
- 桌面版chrome调试APP的webview的步骤:
1. 在chrome地址栏输入:chrome://inspect/ 2.手机插入电脑USB口,打开开发者选项,OK,可以了. 友情链接:http://www.cnblogs.com/slmk/p/75 ...
- POJ 1113 Wall 求凸包
http://poj.org/problem?id=1113 不多说...凸包网上解法很多,这个是用graham的极角排序,也就是算导上的那个解法 其实其他方法随便乱搞都行...我只是测一下模板... ...
- Python Unittest模块测试执行
记录一下Unittest的测试执行相关的点 一.测试用例执行的几种方式 1.通过unittest.main()来执行测试用例的方式: if __name__ == "__main__&quo ...
- C#中选中指定文件并读取类似ini文件的内容
一.背景 由于项目中需要去读取设备的配置信息,配置文件的内容和INI配置文件的格式类似,所以可以按照INI文件的方式来处理.涉及如何打开一个文件,获取打开的文件的路径问题,并读取选中的文件里边的内容. ...
- Vue+TypeScript学习
Vue CLI 内置了 TypeScript 工具支持.在 Vue 的下一个大版本 (3.x) 中也计划了相当多的 TypeScript 支持改进,包括内置的基于 class 的组件 API 和 TS ...