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的更多相关文章

  1. 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 ...

  2. [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 ...

  3. 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 ...

  4. 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 ...

  5. mvn archetype:create报错解决办法

    执行下列命令:mvn archetype:create -DgroupId=com.mycompany.app -DartifactId=my-app -X  会报错: 此时将archetype:cr ...

  6. 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- ...

  7. In App Purchase Statuses

    In App Purchase StatusesThe following are the available states that can be assigned to your in app p ...

  8. 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 ...

  9. [转] 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 ...

随机推荐

  1. Ansible学习记录五:PlayBook学习

    0.介绍 Playbooks 是 Ansible 管理配置.部署应用和编排的语言,可以使用 Playbooks 来描述你想在远程主机执行的策略或者执行的一组步骤过程等 类似于一组任务集,定义好像项目, ...

  2. 洛谷 P2958 [USACO09OCT]木瓜的丛林Papaya Jungle

    P2958 [USACO09OCT]木瓜的丛林Papaya Jungle 题目描述 Bessie has wandered off the farm into the adjoining farmer ...

  3. Flex 正則表達式 电话、邮箱验证

     一.经常使用验证 验证数字:^[0-9]*$ 验证n位的数字:^\d{n}$ 验证至少n位数字:^\d{n,}$ 验证m-n位的数字:^\d{m,n}$ 验证零和非零开头的数字:^(0|[1-9 ...

  4. 旧知识打造新技术--AJAX学习总结

    AJAX是将旧知识在新思想的容器内进行碰撞产生的新技术:推翻传统网页的设计技术,改善用户体验的技术. 学习AJAX之初写过一篇<与Ajax的初次谋面>.当中都仅仅是一些自己浅显的理解.这次 ...

  5. CISP/CISA 每日一题 22

    CISSP 每日一题(答)What should be done to verify patcheshave been applied? Auditpatches, or use a vulnerab ...

  6. C# Bartender模板打印 条码,二维码, 文字, 及操作RFID标签等。

    1.在之前写的一篇文章中, 有讲到如何利用ZPL命令去操作打印里,  后面发现通过模板的方式会更加方便快捷, 既不用去掌握ZPL的实现细节, 就可以轻松的调用实现打印的功能. 解决方案: 1.网络下载 ...

  7. C#泛型(一)泛型方法

    namespace GenericsTest { class Program { // https://www.cnblogs.com/dotnet261010/p/9034594.html stat ...

  8. xpath使用方法详解id 、starts-with、contains、text()和last() 的用法

    1.XPATH使用方法 使用XPATH有如下几种方法定位元素(相比CSS选择器,方法稍微多一点): a.通过绝对路径定位元素(不推荐!) WebElement ele = driver.findEle ...

  9. [寒江孤叶丶的Cocos2d-x之旅_36]用LUA实现UTF8的字符串基本操作 UTF8字符串长度,UTF8字符串剪裁等

    原创文章,欢迎转载,转载请注明:文章来自[寒江孤叶丶的Cocos2d-x之旅系列] 博客地址:http://blog.csdn.net/qq446569365 一个用于UTF8字符串操作的类.功能比較 ...

  10. iOS_06_基本运算符

    一.算术运算 c语言一共有34种运算符,包括了常见的加减乘除 1.加法运算+ # 除了能做加法运算,还能表示正号:+5.+90 2.减法运算- # 除了能做减法运算,还能表示符号:-10.-200 3 ...