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;

最新文章

  1. ASP.NET MVC随想录——漫谈OWIN
  2. org.springframework.beans.MutablePropertyValues.add
  3. 崩溃恢复(crash recovery)与 AUTORESTART参数
  4. 二模07day2解题报告
  5. Perl中的正则表达
  6. git reset and git checkout
  7. ThinkPhp学习07
  8. 后台gird表单按钮操作
  9. 从零自学Hadoop(23):Impala介绍及安装
  10. Maven-12: 插件解析机制
  11. vue-router导航守卫(router.beforeEach())的使用
  12. 洛谷3703 [SDOI2017] 树点染色 【LCT】【线段树】
  13. uboot下读取flash,上传tftp服务器、下载
  14. 2018年全国多校算法寒假训练营练习比赛(第一场)G 圆圈
  15. Android中的动画,选择器,样式和主题的使用
  16. 165. Merge Two Sorted Lists【LintCode by java】
  17. Luogu 4198 楼房重建
  18. 在DZ 中 showmessage 中可以再次执行 JS
  19. rcnn caffe matlab 配置完成 14.04 cuda 7.0
  20. 一种基于自定义代码的asp.net网站访问IP过滤方法!

热门文章

  1. 如何在手机上查看测试vue-cli构建的项目
  2. [Angular] Make a chatbot with DialogFlow
  3. LeetCode OJ Basic Calculator II
  4. Java IO:SocketChannel和Selector在ZooKeeper中应用
  5. values-dimen 不同分辨率资源实现引用
  6. inflater-布局转化实现
  7. [BZOJ1645][Usaco2007 Open]City Horizon 城市地平线 线段树
  8. WSDL生成dll
  9. 随时查看源码的网站---http://www.sooset.com/
  10. C#监控代码运行的时间