UNPKG

29.8 kBMarkdownView Raw
1<p align="center">
2<a href="https://preactjs.com" target="_blank">
3<img alt="Preact" title="Preact" src="https://cdn.rawgit.com/developit/b4416d5c92b743dbaec1e68bc4c27cda/raw/3235dc508f7eb834ebf48418aea212a05df13db1/preact-logo-trans.svg" width="550">
4</a>
5</p>
6<p align="center">Fast <b>3kB</b> alternative to React, with the same ES2015 API.</p>
7
8**All the power of Virtual DOM components, without the overhead:**
9
10- Familiar React API & patterns: [ES6 Class] and [Functional Components]
11- Extensive React compatibility via a simple [preact-compat] alias
12- Everything you need: JSX, <abbr title="Virtual DOM">VDOM</abbr>, React DevTools, <abbr title="Hot Module Replacement">HMR</abbr>, <abbr title="Server-Side Rendering">SSR</abbr>..
13- A highly optimized diff algorithm and seamless Server Side Rendering
14- Transparent asynchronous rendering with a pluggable scheduler
15- 🆕💥 **Instant no-config app bundling with [Preact CLI](https://github.com/developit/preact-cli)**
16
17### 💁 More information at the [Preact Website ➞](https://preactjs.com)
18
19
20---
21
22<!-- TOC depthFrom:2 depthTo:6 withLinks:1 updateOnSave:1 orderedList:0 -->
23
24- [Demos](#demos)
25- [Libraries & Add-ons](#libraries--add-ons)
26- [Getting Started](#getting-started)
27 - [Import what you need](#import-what-you-need)
28 - [Rendering JSX](#rendering-jsx)
29 - [Components](#components)
30 - [Props & State](#props--state)
31- [Linked State](#linked-state)
32- [Examples](#examples)
33- [Extensions](#extensions)
34- [Developer Tools](#developer-tools)
35- [Backers](#backers)
36- [Sponsors](#sponsors)
37- [License](#license)
38
39<!-- /TOC -->
40
41
42# Preact
43
44[![npm](https://img.shields.io/npm/v/preact.svg)](http://npm.im/preact)
45[![CDNJS](https://img.shields.io/cdnjs/v/preact.svg)](https://cdnjs.com/libraries/preact)
46[![Preact Slack Community](https://preact-slack.now.sh/badge.svg)](https://preact-slack.now.sh)
47[![OpenCollective Backers](https://opencollective.com/preact/backers/badge.svg)](#backers)
48[![OpenCollective Sponsors](https://opencollective.com/preact/sponsors/badge.svg)](#sponsors)
49[![travis](https://travis-ci.org/developit/preact.svg?branch=master)](https://travis-ci.org/developit/preact)
50[![coveralls](https://img.shields.io/coveralls/developit/preact/master.svg)](https://coveralls.io/github/developit/preact)
51[![gzip size](http://img.badgesize.io/https://unpkg.com/preact/dist/preact.min.js?compression=gzip)](https://unpkg.com/preact/dist/preact.min.js)
52
53Preact supports modern browsers and IE9+:
54
55[![Browsers](https://saucelabs.com/browser-matrix/preact.svg)](https://saucelabs.com/u/preact)
56
57
58---
59
60
61## Demos
62
63- [**ESBench**](http://esbench.com) is built using Preact.
64- [**Nectarine.rocks**](http://nectarine.rocks) _([GitHub Project](https://github.com/developit/nectarine))_ :peach:
65- [**Documentation Viewer**](https://documentation-viewer.firebaseapp.com) _([GitHub Project](https://github.com/developit/documentation-viewer))_
66- [**TodoMVC**](https://preact-todomvc.surge.sh) _([GitHub Project](https://github.com/developit/preact-todomvc))_
67- [**Hacker News Minimal**](https://developit.github.io/hn_minimal/) _([GitHub Project](https://github.com/developit/hn_minimal))_
68- [**Preact Boilerplate**](https://preact-boilerplate.surge.sh) _([GitHub Project](https://github.com/developit/preact-boilerplate))_ :zap:
69- [**Preact Offline Starter**](https://preact-starter.now.sh) _([GitHub Project](https://github.com/lukeed/preact-starter))_ :100:
70- [**Preact PWA**](https://preact-pwa.appspot.com/) _([GitHub Project](https://github.com/ezekielchentnik/preact-pwa))_ :hamburger:
71- [**Preact Mobx Starter**](https://awaw00.github.io/preact-mobx-starter/) _([GitHub Project](https://github.com/awaw00/preact-mobx-starter))_ :sunny:
72- [**Preact Redux Example**](https://github.com/developit/preact-redux-example) :star:
73- [**Flickr Browser**](http://codepen.io/developit/full/VvMZwK/) (@ CodePen)
74- [**Animating Text**](http://codepen.io/developit/full/LpNOdm/) (@ CodePen)
75- [**60FPS Rainbow Spiral**](http://codepen.io/developit/full/xGoagz/) (@ CodePen)
76- [**Simple Clock**](http://jsfiddle.net/developit/u9m5x0L7/embedded/result,js/) (@ JSFiddle)
77- [**3D + ThreeJS**](http://codepen.io/developit/pen/PPMNjd?editors=0010) (@ CodePen)
78- [**Stock Ticker**](http://codepen.io/developit/pen/wMYoBb?editors=0010) (@ CodePen)
79- [**Create your Own!**](https://jsfiddle.net/developit/rs6zrh5f/embedded/result/) (@ JSFiddle)
80- [**Preact Coffeescript**](https://github.com/crisward/preact-coffee)
81- [**GuriVR**](https://gurivr.com) _([GitHub Project](https://github.com/opennewslabs/guri-vr))_
82- [**V2EX Preact**](https://github.com/yanni4night/v2ex-preact)
83- [**BigWebQuiz**](https://bigwebquiz.com/) _([GitHub Project](https://github.com/jakearchibald/big-web-quiz))_
84- [**Color Picker**](https://colors.now.sh) _([GitHub Project](https://github.com/lukeed/colors-app))_ :art:
85- [**Rainbow Explorer**](https://use-the-platform.com/rainbow-explorer/) _([GitHub Project](https://github.com/vaneenige/rainbow-explorer/))_ :rainbow:
86- [**Offline Gallery**](https://use-the-platform.com/offline-gallery/) _([GitHub Project](https://github.com/vaneenige/offline-gallery/))_ :balloon:
87- [**Periodic Weather**](https://use-the-platform.com/periodic-weather/) _([GitHub Project](https://github.com/vaneenige/periodic-weather/))_ :sunny:
88- [**Play.cash**](https://play.cash) :notes:
89- [**Rugby News Board**](http://nbrugby.com) _[(GitHub Project)](https://github.com/rugby-board/rugby-board-node)_
90
91## Libraries & Add-ons
92
93- :raised_hands: [**preact-compat**](https://git.io/preact-compat): use any React library with Preact *([full example](http://git.io/preact-compat-example))*
94- :page_facing_up: [**preact-render-to-string**](https://git.io/preact-render-to-string): Universal rendering.
95- :loop: [**preact-render-to-json**](https://git.io/preact-render-to-json): Render for Jest Snapshot testing.
96- :earth_americas: [**preact-router**](https://git.io/preact-router): URL routing for your components
97- :bookmark_tabs: [**preact-markup**](https://git.io/preact-markup): Render HTML & Custom Elements as JSX & Components
98- :satellite: [**preact-portal**](https://git.io/preact-portal): Render Preact components into (a) SPACE :milky_way:
99- :pencil: [**preact-richtextarea**](https://git.io/preact-richtextarea): Simple HTML editor component
100- :bookmark: [**preact-token-input**](https://github.com/developit/preact-token-input): Text field that tokenizes input, for things like tags
101- :card_index: [**preact-virtual-list**](https://github.com/developit/preact-virtual-list): Easily render lists with millions of rows ([demo](https://jsfiddle.net/developit/qqan9pdo/))
102- :repeat: [**preact-cycle**](https://git.io/preact-cycle): Functional-reactive paradigm for Preact
103- :triangular_ruler: [**preact-layout**](https://download.github.io/preact-layout/): Small and simple layout library
104- :thought_balloon: [**preact-socrates**](https://github.com/matthewmueller/preact-socrates): Preact plugin for [Socrates](http://github.com/matthewmueller/socrates)
105- :rowboat: [**preact-flyd**](https://github.com/xialvjun/preact-flyd): Use [flyd](https://github.com/paldepind/flyd) FRP streams in Preact + JSX
106- :speech_balloon: [**preact-i18nline**](https://github.com/download/preact-i18nline): Integrates the ecosystem around [i18n-js](https://github.com/everydayhero/i18n-js) with Preact via [i18nline](https://github.com/download/i18nline).
107- :microscope: [**preact-jsx-chai**](https://git.io/preact-jsx-chai): JSX assertion testing _(no DOM, right in Node)_
108- :tophat: [**preact-classless-component**](https://github.com/ld0rman/preact-classless-component): create preact components without the class keyword
109- :hammer: [**preact-hyperscript**](https://github.com/queckezz/preact-hyperscript): Hyperscript-like syntax for creating elements
110- :white_check_mark: [**shallow-compare**](https://github.com/tkh44/shallow-compare): simplified `shouldComponentUpdate` helper.
111- :shaved_ice: [**preact-codemod**](https://github.com/vutran/preact-codemod): Transform your React code to Preact.
112- :construction_worker: [**preact-helmet**](https://github.com/download/preact-helmet): A document head manager for Preact
113- :necktie: [**preact-delegate**](https://github.com/NekR/preact-delegate): Delegate DOM events
114
115#### UI Component Libraries
116
117> Want to prototype something or speed up your development? Try one of these toolkits:
118
119- [**preact-material-components**](https://github.com/prateekbh/preact-material-components): Material Design Components for Preact ([website](https://prateekbh.github.io/preact-material-components/))
120- [**preact-mdc**](https://github.com/BerndWessels/preact-mdc): Material Design Components for Preact ([demo](https://github.com/BerndWessels/preact-mdc-demo))
121- [**preact-mui**](https://git.io/v1aVO): The MUI CSS Preact library.
122- [**preact-photon**](https://git.io/preact-photon): build beautiful desktop UI with [photon](http://photonkit.com)
123- [**preact-mdl**](https://git.io/preact-mdl): [Material Design Lite](https://getmdl.io) for Preact
124- [**preact-weui**](https://github.com/afeiship/preact-weui): [Weui](https://github.com/afeiship/preact-weui) for Preact
125
126
127---
128
129## Getting Started
130
131> 💁 _**Note:** You [don't need ES2015 to use Preact](https://github.com/developit/preact-in-es3)... but give it a try!_
132
133The easiest way to get started with Preact is to install [Preact CLI](https://github.com/developit/preact-cli). This simple command-line tool wraps up the best possible Webpack and Babel setup for you, and even keeps you up-to-date as the underlying tools change. Best of all, it's easy to understand! It builds your app in a single command (`preact build`), doesn't need any configuration, and bakes in best-practises 🙌.
134
135The following guide assumes you have some sort of ES2015 build set up using babel and/or webpack/browserify/gulp/grunt/etc.
136
137You can also start with [preact-boilerplate] or a [CodePen Template](http://codepen.io/developit/pen/pgaROe?editors=0010).
138
139
140### Import what you need
141
142The `preact` module provides both named and default exports, so you can either import everything under a namespace of your choosing, or just what you need as locals:
143
144##### Named:
145
146```js
147import { h, render, Component } from 'preact';
148
149// Tell Babel to transform JSX into h() calls:
150/** @jsx h */
151```
152
153##### Default:
154
155```js
156import preact from 'preact';
157
158// Tell Babel to transform JSX into preact.h() calls:
159/** @jsx preact.h */
160```
161
162> Named imports work well for highly structured applications, whereas the default import is quick and never needs to be updated when using different parts of the library.
163>
164> Instead of declaring the `@jsx` pragma in your code, it's best to configure it globally in a `.babelrc`:
165>
166> **For Babel 5 and prior:**
167>
168> ```json
169> { "jsxPragma": "h" }
170> ```
171>
172> **For Babel 6:**
173>
174> ```json
175> {
176> "plugins": [
177> ["transform-react-jsx", { "pragma":"h" }]
178> ]
179> }
180> ```
181
182
183### Rendering JSX
184
185Out of the box, Preact provides an `h()` function that turns your JSX into Virtual DOM elements _([here's how](http://jasonformat.com/wtf-is-jsx))_. It also provides a `render()` function that creates a DOM tree from that Virtual DOM.
186
187To render some JSX, just import those two functions and use them like so:
188
189```js
190import { h, render } from 'preact';
191
192render((
193 <div id="foo">
194 <span>Hello, world!</span>
195 <button onClick={ e => alert("hi!") }>Click Me</button>
196 </div>
197), document.body);
198```
199
200This should seem pretty straightforward if you've used hyperscript or one of its many friends. If you're not, the short of it is that the h function import gets used in the final, transpiled code as a drop in replacement for React.createElement, and so needs to be imported even if you don't explicitly use it in the code you write. Also note that if you're the kind of person who likes writing your React code in "pure JavaScript" (you know who you are) you will need to use h(...) wherever you would otherwise use React.createElement.
201
202Rendering hyperscript with a virtual DOM is pointless, though. We want to render components and have them updated when data changes - that's where the power of virtual DOM diffing shines. :star2:
203
204
205### Components
206
207Preact exports a generic `Component` class, which can be extended to build encapsulated, self-updating pieces of a User Interface. Components support all of the standard React [lifecycle methods], like `shouldComponentUpdate()` and `componentWillReceiveProps()`. Providing specific implementations of these methods is the preferred mechanism for controlling _when_ and _how_ components update.
208
209Components also have a `render()` method, but unlike React this method is passed `(props, state)` as arguments. This provides an ergonomic means to destructure `props` and `state` into local variables to be referenced from JSX.
210
211Let's take a look at a very simple `Clock` component, which shows the current time.
212
213```js
214import { h, render, Component } from 'preact';
215
216class Clock extends Component {
217 render() {
218 let time = new Date().toLocaleTimeString();
219 return <span>{ time }</span>;
220 }
221}
222
223// render an instance of Clock into <body>:
224render(<Clock />, document.body);
225```
226
227
228That's great. Running this produces the following HTML DOM structure:
229
230```html
231<span>10:28:57 PM</span>
232```
233
234In order to have the clock's time update every second, we need to know when `<Clock>` gets mounted to the DOM. _If you've used HTML5 Custom Elements, this is similar to the `attachedCallback` and `detachedCallback` lifecycle methods._ Preact invokes the following lifecycle methods if they are defined for a Component:
235
236| Lifecycle method | When it gets called |
237|-----------------------------|--------------------------------------------------|
238| `componentWillMount` | before the component gets mounted to the DOM |
239| `componentDidMount` | after the component gets mounted to the DOM |
240| `componentWillUnmount` | prior to removal from the DOM |
241| `componentWillReceiveProps` | before new props get accepted |
242| `shouldComponentUpdate` | before `render()`. Return `false` to skip render |
243| `componentWillUpdate` | before `render()` |
244| `componentDidUpdate` | after `render()` |
245
246
247
248So, we want to have a 1-second timer start once the Component gets added to the DOM, and stop if it is removed. We'll create the timer and store a reference to it in `componentDidMount`, and stop the timer in `componentWillUnmount`. On each timer tick, we'll update the component's `state` object with a new time value. Doing this will automatically re-render the component.
249
250```js
251import { h, render, Component } from 'preact';
252
253class Clock extends Component {
254 constructor() {
255 super();
256 // set initial time:
257 this.state = {
258 time: Date.now()
259 };
260 }
261
262 componentDidMount() {
263 // update time every second
264 this.timer = setInterval(() => {
265 this.setState({ time: Date.now() });
266 }, 1000);
267 }
268
269 componentWillUnmount() {
270 // stop when not renderable
271 clearInterval(this.timer);
272 }
273
274 render(props, state) {
275 let time = new Date(state.time).toLocaleTimeString();
276 return <span>{ time }</span>;
277 }
278}
279
280// render an instance of Clock into <body>:
281render(<Clock />, document.body);
282```
283
284Now we have [a ticking clock](http://jsfiddle.net/developit/u9m5x0L7/embedded/result,js/)!
285
286
287### Props & State
288
289The concept (and nomenclature) for `props` and `state` is the same as in React. `props` are passed to a component by defining attributes in JSX, `state` is internal state. Changing either triggers a re-render, though by default Preact re-renders Components asynchronously for `state` changes and synchronously for `props` changes. You can tell Preact to render `prop` changes asynchronously by setting `options.syncComponentUpdates` to `false`.
290
291
292---
293
294
295## Linked State
296
297One area Preact takes a little further than React is in optimizing state changes. A common pattern in ES2015 React code is to use Arrow functions within a `render()` method in order to update state in response to events. Creating functions enclosed in a scope on every render is inefficient and forces the garbage collector to do more work than is necessary.
298
299One solution to this is to bind component methods declaratively.
300Here is an example using [decko](http://git.io/decko):
301
302```js
303class Foo extends Component {
304 @bind
305 updateText(e) {
306 this.setState({ text: e.target.value });
307 }
308 render({ }, { text }) {
309 return <input value={text} onInput={this.updateText} />;
310 }
311}
312```
313
314While this achieves much better runtime performance, it's still a lot of unnecessary code to wire up state to UI.
315
316Fortunately there is a solution, in the form of a module called [linkstate](https://github.com/developit/linkstate). Calling `linkState(component, 'text')` returns a function that accepts an Event and uses it's associated value to update the given property in your component's state. Calls to `linkState()` with the same arguments are cached, so there is no performance penalty. Here is the previous example rewritten using _Linked State_:
317
318```js
319import linkState from 'linkstate';
320
321class Foo extends Component {
322 render({ }, { text }) {
323 return <input value={text} onInput={linkState(this, 'text')} />;
324 }
325}
326```
327
328Simple and effective. It handles linking state from any input type, or an optional second parameter can be used to explicitly provide a keypath to the new state value.
329
330> **Note:** In Preact 7 and prior, `linkState()` was built right into Component. In 8.0, it was moved to a separate module. You can restore the 7.x behavior by using linkstate as a polyfill - see [the linkstate docs](https://github.com/developit/linkstate#usage).
331
332
333
334## Examples
335
336Here is a somewhat verbose Preact `<Link>` component:
337
338```js
339class Link extends Component {
340 render(props, state) {
341 return <a href={props.href}>{props.children}</a>;
342 }
343}
344```
345
346Since this is ES6/ES2015, we can further simplify:
347
348```js
349class Link extends Component {
350 render({ href, children }) {
351 return <a {...{ href, children }} />;
352 }
353}
354
355// or, for wide-open props support:
356class Link extends Component {
357 render(props) {
358 return <a {...props} />;
359 }
360}
361
362// or, as a stateless functional component:
363const Link = ({ children, ...props }) => (
364 <a {...props}>{ children }</a>
365);
366```
367
368
369## Extensions
370
371It is likely that some projects based on Preact would wish to extend Component with great new functionality.
372
373Perhaps automatic connection to stores for a Flux-like architecture, or mixed-in context bindings to make it feel more like `React.createClass()`. Just use ES2015 inheritance:
374
375```js
376class BoundComponent extends Component {
377 constructor(props) {
378 super(props);
379 this.bind();
380 }
381 bind() {
382 this.binds = {};
383 for (let i in this) {
384 this.binds[i] = this[i].bind(this);
385 }
386 }
387}
388
389// example usage
390class Link extends BoundComponent {
391 click() {
392 open(this.href);
393 }
394 render() {
395 let { click } = this.binds;
396 return <span onclick={ click }>{ children }</span>;
397 }
398}
399```
400
401
402The possibilities are pretty endless here. You could even add support for rudimentary mixins:
403
404```js
405class MixedComponent extends Component {
406 constructor() {
407 super();
408 (this.mixins || []).forEach( m => Object.assign(this, m) );
409 }
410}
411```
412
413## Developer Tools
414
415You can inspect and modify the state of your Preact UI components at runtime using the
416[React Developer Tools](https://github.com/facebook/react-devtools) browser extension.
417
4181. Install the [React Developer Tools](https://github.com/facebook/react-devtools) extension
4192. Import the "preact/devtools" module in your app
4203. Reload and go to the 'React' tab in the browser's development tools
421
422
423```js
424import { h, Component, render } from 'preact';
425
426// Enable devtools. You can reduce the size of your app by only including this
427// module in development builds. eg. In Webpack, wrap this with an `if (module.hot) {...}`
428// check.
429require('preact/devtools');
430```
431
432
433
434## Backers
435Support us with a monthly donation and help us continue our activities. [[Become a backer](https://opencollective.com/preact#backer)]
436
437<a href="https://opencollective.com/preact/backer/0/website" target="_blank"><img src="https://opencollective.com/preact/backer/0/avatar.svg"></a>
438<a href="https://opencollective.com/preact/backer/1/website" target="_blank"><img src="https://opencollective.com/preact/backer/1/avatar.svg"></a>
439<a href="https://opencollective.com/preact/backer/2/website" target="_blank"><img src="https://opencollective.com/preact/backer/2/avatar.svg"></a>
440<a href="https://opencollective.com/preact/backer/3/website" target="_blank"><img src="https://opencollective.com/preact/backer/3/avatar.svg"></a>
441<a href="https://opencollective.com/preact/backer/4/website" target="_blank"><img src="https://opencollective.com/preact/backer/4/avatar.svg"></a>
442<a href="https://opencollective.com/preact/backer/5/website" target="_blank"><img src="https://opencollective.com/preact/backer/5/avatar.svg"></a>
443<a href="https://opencollective.com/preact/backer/6/website" target="_blank"><img src="https://opencollective.com/preact/backer/6/avatar.svg"></a>
444<a href="https://opencollective.com/preact/backer/7/website" target="_blank"><img src="https://opencollective.com/preact/backer/7/avatar.svg"></a>
445<a href="https://opencollective.com/preact/backer/8/website" target="_blank"><img src="https://opencollective.com/preact/backer/8/avatar.svg"></a>
446<a href="https://opencollective.com/preact/backer/9/website" target="_blank"><img src="https://opencollective.com/preact/backer/9/avatar.svg"></a>
447<a href="https://opencollective.com/preact/backer/10/website" target="_blank"><img src="https://opencollective.com/preact/backer/10/avatar.svg"></a>
448<a href="https://opencollective.com/preact/backer/11/website" target="_blank"><img src="https://opencollective.com/preact/backer/11/avatar.svg"></a>
449<a href="https://opencollective.com/preact/backer/12/website" target="_blank"><img src="https://opencollective.com/preact/backer/12/avatar.svg"></a>
450<a href="https://opencollective.com/preact/backer/13/website" target="_blank"><img src="https://opencollective.com/preact/backer/13/avatar.svg"></a>
451<a href="https://opencollective.com/preact/backer/14/website" target="_blank"><img src="https://opencollective.com/preact/backer/14/avatar.svg"></a>
452<a href="https://opencollective.com/preact/backer/15/website" target="_blank"><img src="https://opencollective.com/preact/backer/15/avatar.svg"></a>
453<a href="https://opencollective.com/preact/backer/16/website" target="_blank"><img src="https://opencollective.com/preact/backer/16/avatar.svg"></a>
454<a href="https://opencollective.com/preact/backer/17/website" target="_blank"><img src="https://opencollective.com/preact/backer/17/avatar.svg"></a>
455<a href="https://opencollective.com/preact/backer/18/website" target="_blank"><img src="https://opencollective.com/preact/backer/18/avatar.svg"></a>
456<a href="https://opencollective.com/preact/backer/19/website" target="_blank"><img src="https://opencollective.com/preact/backer/19/avatar.svg"></a>
457<a href="https://opencollective.com/preact/backer/20/website" target="_blank"><img src="https://opencollective.com/preact/backer/20/avatar.svg"></a>
458<a href="https://opencollective.com/preact/backer/21/website" target="_blank"><img src="https://opencollective.com/preact/backer/21/avatar.svg"></a>
459<a href="https://opencollective.com/preact/backer/22/website" target="_blank"><img src="https://opencollective.com/preact/backer/22/avatar.svg"></a>
460<a href="https://opencollective.com/preact/backer/23/website" target="_blank"><img src="https://opencollective.com/preact/backer/23/avatar.svg"></a>
461<a href="https://opencollective.com/preact/backer/24/website" target="_blank"><img src="https://opencollective.com/preact/backer/24/avatar.svg"></a>
462<a href="https://opencollective.com/preact/backer/25/website" target="_blank"><img src="https://opencollective.com/preact/backer/25/avatar.svg"></a>
463<a href="https://opencollective.com/preact/backer/26/website" target="_blank"><img src="https://opencollective.com/preact/backer/26/avatar.svg"></a>
464<a href="https://opencollective.com/preact/backer/27/website" target="_blank"><img src="https://opencollective.com/preact/backer/27/avatar.svg"></a>
465<a href="https://opencollective.com/preact/backer/28/website" target="_blank"><img src="https://opencollective.com/preact/backer/28/avatar.svg"></a>
466<a href="https://opencollective.com/preact/backer/29/website" target="_blank"><img src="https://opencollective.com/preact/backer/29/avatar.svg"></a>
467
468
469## Sponsors
470Become a sponsor and get your logo on our README on GitHub with a link to your site. [[Become a sponsor](https://opencollective.com/preact#sponsor)]
471
472<a href="https://opencollective.com/preact/sponsor/0/website" target="_blank"><img src="https://opencollective.com/preact/sponsor/0/avatar.svg"></a>
473<a href="https://opencollective.com/preact/sponsor/1/website" target="_blank"><img src="https://opencollective.com/preact/sponsor/1/avatar.svg"></a>
474<a href="https://opencollective.com/preact/sponsor/2/website" target="_blank"><img src="https://opencollective.com/preact/sponsor/2/avatar.svg"></a>
475<a href="https://opencollective.com/preact/sponsor/3/website" target="_blank"><img src="https://opencollective.com/preact/sponsor/3/avatar.svg"></a>
476<a href="https://opencollective.com/preact/sponsor/4/website" target="_blank"><img src="https://opencollective.com/preact/sponsor/4/avatar.svg"></a>
477<a href="https://opencollective.com/preact/sponsor/5/website" target="_blank"><img src="https://opencollective.com/preact/sponsor/5/avatar.svg"></a>
478<a href="https://opencollective.com/preact/sponsor/6/website" target="_blank"><img src="https://opencollective.com/preact/sponsor/6/avatar.svg"></a>
479<a href="https://opencollective.com/preact/sponsor/7/website" target="_blank"><img src="https://opencollective.com/preact/sponsor/7/avatar.svg"></a>
480<a href="https://opencollective.com/preact/sponsor/8/website" target="_blank"><img src="https://opencollective.com/preact/sponsor/8/avatar.svg"></a>
481<a href="https://opencollective.com/preact/sponsor/9/website" target="_blank"><img src="https://opencollective.com/preact/sponsor/9/avatar.svg"></a>
482<a href="https://opencollective.com/preact/sponsor/10/website" target="_blank"><img src="https://opencollective.com/preact/sponsor/10/avatar.svg"></a>
483<a href="https://opencollective.com/preact/sponsor/11/website" target="_blank"><img src="https://opencollective.com/preact/sponsor/11/avatar.svg"></a>
484<a href="https://opencollective.com/preact/sponsor/12/website" target="_blank"><img src="https://opencollective.com/preact/sponsor/12/avatar.svg"></a>
485<a href="https://opencollective.com/preact/sponsor/13/website" target="_blank"><img src="https://opencollective.com/preact/sponsor/13/avatar.svg"></a>
486<a href="https://opencollective.com/preact/sponsor/14/website" target="_blank"><img src="https://opencollective.com/preact/sponsor/14/avatar.svg"></a>
487<a href="https://opencollective.com/preact/sponsor/15/website" target="_blank"><img src="https://opencollective.com/preact/sponsor/15/avatar.svg"></a>
488<a href="https://opencollective.com/preact/sponsor/16/website" target="_blank"><img src="https://opencollective.com/preact/sponsor/16/avatar.svg"></a>
489<a href="https://opencollective.com/preact/sponsor/17/website" target="_blank"><img src="https://opencollective.com/preact/sponsor/17/avatar.svg"></a>
490<a href="https://opencollective.com/preact/sponsor/18/website" target="_blank"><img src="https://opencollective.com/preact/sponsor/18/avatar.svg"></a>
491<a href="https://opencollective.com/preact/sponsor/19/website" target="_blank"><img src="https://opencollective.com/preact/sponsor/19/avatar.svg"></a>
492<a href="https://opencollective.com/preact/sponsor/20/website" target="_blank"><img src="https://opencollective.com/preact/sponsor/20/avatar.svg"></a>
493<a href="https://opencollective.com/preact/sponsor/21/website" target="_blank"><img src="https://opencollective.com/preact/sponsor/21/avatar.svg"></a>
494<a href="https://opencollective.com/preact/sponsor/22/website" target="_blank"><img src="https://opencollective.com/preact/sponsor/22/avatar.svg"></a>
495<a href="https://opencollective.com/preact/sponsor/23/website" target="_blank"><img src="https://opencollective.com/preact/sponsor/23/avatar.svg"></a>
496<a href="https://opencollective.com/preact/sponsor/24/website" target="_blank"><img src="https://opencollective.com/preact/sponsor/24/avatar.svg"></a>
497<a href="https://opencollective.com/preact/sponsor/25/website" target="_blank"><img src="https://opencollective.com/preact/sponsor/25/avatar.svg"></a>
498<a href="https://opencollective.com/preact/sponsor/26/website" target="_blank"><img src="https://opencollective.com/preact/sponsor/26/avatar.svg"></a>
499<a href="https://opencollective.com/preact/sponsor/27/website" target="_blank"><img src="https://opencollective.com/preact/sponsor/27/avatar.svg"></a>
500<a href="https://opencollective.com/preact/sponsor/28/website" target="_blank"><img src="https://opencollective.com/preact/sponsor/28/avatar.svg"></a>
501<a href="https://opencollective.com/preact/sponsor/29/website" target="_blank"><img src="https://opencollective.com/preact/sponsor/29/avatar.svg"></a>
502
503## License
504
505MIT
506
507
508
509[![Preact](http://i.imgur.com/YqCHvEW.gif)](https://preactjs.com)
510
511
512[preact-compat]: https://github.com/developit/preact-compat
513[ES6 Class]: https://facebook.github.io/react/docs/reusable-components.html#es6-classes
514[Functional Components]: https://facebook.github.io/react/blog/2015/10/07/react-v0.14.html#stateless-functional-components
515[hyperscript]: https://github.com/dominictarr/hyperscript
516[preact-boilerplate]: https://github.com/developit/preact-boilerplate
517[lifecycle methods]: https://facebook.github.io/react/docs/component-specs.html