[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 ...
随机推荐
- LuoguP1251 餐巾计划问题(费用流)
题目描述 一个餐厅在相继的 NN 天里,每天需用的餐巾数不尽相同.假设第 ii 天需要 r_iri块餐巾( i=1,2,...,N).餐厅可以购买新的餐巾,每块餐巾的费用为 pp 分;或者把旧餐巾送 ...
- Linux编译ffmpeg
Linux编译ffmpeg并转换MP3到AMR AMR格式是智能手机上的常用音频文件格式,比如MP3格式的压缩比大,但是文件比MP3小,所以在移动互联项目中应用比较广泛.去年年底协助联想研究院开发一款 ...
- 洛谷P3165 [CQOI2014]排序机械臂
题目描述 为了把工厂中高低不等的物品按从低到高排好序,工程师发明了一种排序机械臂.它遵循一个简单的排序规则,第一次操作找到摄低的物品的位置P1,并把左起第一个至P1间的物品反序:第二次找到第二低的物品 ...
- 玩转Bootstrap(基础) -- (6.导航条基础)
1.导航条样例 <!DOCTYPE HTML> <html> <head> <meta http-equiv="Content-Type" ...
- amazeui学习笔记二(进阶开发4)--JavaScript规范Rules
amazeui学习笔记二(进阶开发4)--JavaScript规范Rules 一.总结 1.注释规范总原则: As short as possible(如无必要,勿增注释):尽量提高代码本身的清晰性. ...
- libcurl 通过http协议下载文件并显示下载进度
vc6 测试工程下载地址:http://download.csdn.net/detail/mtour/8068053 代码如下: size_t my_write_func(void *ptr, siz ...
- select下拉列表选中后,跳转新链接
1.在当前页面打开新链接 <select onchange="location.href=this.options[this.selectedIndex].value" na ...
- jquery追加元素,移除DOM,jqueryDOM操作
1.append() 方法在被选元素的结尾插入内容. 2.prepend() 方法在被选元素的开头插入内容. 3.after() 方法在被选元素之后插入内容. 4.before() 方法在被选元素之前 ...
- Docker---(4)Docker 部署spring web项目
原文:Docker---(4)Docker 部署spring web项目 版权声明:欢迎转载,请标明出处,如有问题,欢迎指正!谢谢!微信:w1186355422 https://blog.csdn.n ...
- 【习题 6-3 UVA - 536】 Tree Recovery
[链接] 我是链接,点我呀:) [题意] 在这里输入题意 [题解] 递归题 [代码] #include <bits/stdc++.h> using namespace std; const ...