diff --git a/content/en/index.md b/content/en/index.md
index 356bad0df..fa58ac03b 100755
--- a/content/en/index.md
+++ b/content/en/index.md
@@ -12,8 +12,8 @@ description: 'Preact is a fast 3kB alternative to React with the same modern API
Fast 3kB alternative to React with the same modern API.
diff --git a/content/en/index.md b/content/en/index.md
index fa58ac03b..95db8ae8b 100755
--- a/content/en/index.md
+++ b/content/en/index.md
@@ -12,8 +12,8 @@ description: 'Preact is a fast 3kB alternative to React with the same modern API
Fast 3kB alternative to React with the same modern API.
```jsx
diff --git a/content/en/index.md b/content/en/index.md
index 95db8ae8b..b9784c011 100755
--- a/content/en/index.md
+++ b/content/en/index.md
@@ -15,9 +15,6 @@ description: 'Preact is a fast 3kB alternative to React with the same modern API
Get StartedSwitch to Preact
-
- 20,000+
-
```jsx
diff --git a/content/es/index.md b/content/es/index.md
index 86f760e65..79443fa59 100755
--- a/content/es/index.md
+++ b/content/es/index.md
@@ -15,9 +15,6 @@ toc: false
Primeros pasosCambiar a Preact
-
Schnelle 3kB-Alternative zu React mit der gleichen ES6-API.
+
Schnelle 3kB-Alternative zu React mit der gleichen ES6-API.
Fang anWechsle zu Preact
diff --git a/content/en/index.md b/content/en/index.md
index b9784c011..8b9b9ea7a 100755
--- a/content/en/index.md
+++ b/content/en/index.md
@@ -10,7 +10,7 @@ description: 'Preact is a fast 3kB alternative to React with the same modern API
Preact
-
Fast 3kB alternative to React with the same modern API.
+
Fast 3kB alternative to React with the same modern API.
Get StartedSwitch to Preact
diff --git a/content/es/index.md b/content/es/index.md
index 79443fa59..6b0b38755 100755
--- a/content/es/index.md
+++ b/content/es/index.md
@@ -10,7 +10,7 @@ toc: false
Preact
-
Una alternativa veloz a React en 3kB con la misma API de ES6.
+
Una alternativa veloz a React en 3kB con la misma API de ES6.
Primeros pasosCambiar a Preact
diff --git a/content/fr/index.md b/content/fr/index.md
index 0e84030ce..9d8ead9ab 100755
--- a/content/fr/index.md
+++ b/content/fr/index.md
@@ -9,7 +9,7 @@ toc: false
Preact
-
Alternative légère et rapide à React avec le même API en seulement 3Ko.
+
Alternative légère et rapide à React avec le même API en seulement 3Ko.
CommencerPasser à preact
diff --git a/content/it/index.md b/content/it/index.md
index 25ed058d7..1a8cfb449 100755
--- a/content/it/index.md
+++ b/content/it/index.md
@@ -10,7 +10,7 @@ toc: false
Preact
-
Un alternativa veloce e leggera 3Kb a React con le stesse moderne API.
+
Un alternativa veloce e leggera 3Kb a React con le stesse moderne API.
Primi PassiPassare a Preact
diff --git a/content/pt-br/index.md b/content/pt-br/index.md
index dc88e4a5a..c9156f7c1 100755
--- a/content/pt-br/index.md
+++ b/content/pt-br/index.md
@@ -10,7 +10,7 @@ toc: false
Preact
-
Uma alternativa ao React com apenas 3kB e a mesma API ES6.
+
Uma alternativa ao React com apenas 3kB e a mesma API ES6.
Como começarMudando para Preact
diff --git a/content/tr/index.md b/content/tr/index.md
index 5e5a526e8..ce25a6f84 100755
--- a/content/tr/index.md
+++ b/content/tr/index.md
@@ -10,7 +10,7 @@ toc: false
Preact
-
Aynı modern API ile React'e hızlı ve 3kB'lık alternatif.
+
Aynı modern API ile React'e hızlı ve 3kB'lık alternatif.
BaşlangıçPreact'e Geçiş
diff --git a/content/zh/index.md b/content/zh/index.md
index c91670d28..60404d676 100755
--- a/content/zh/index.md
+++ b/content/zh/index.md
@@ -10,7 +10,7 @@ toc: false
diff --git a/src/components/sponsors/index.js b/src/components/sponsors/index.js
new file mode 100644
index 000000000..98f068072
--- /dev/null
+++ b/src/components/sponsors/index.js
@@ -0,0 +1,79 @@
+import styles from './style.less';
+
+/**
+ * Sponsors on the main page is a unique selling point of our
+ * gold and platinum tier on opencollective. See:
+ * https://opencollective.com/preact for an overview of
+ * available tiers and their advantages.
+ */
+export default function Sponsors() {
+ return (
+
{
- onClick(!isActive ? id : '');
+ onClick(id, !isActive);
}, [onClick, id, isActive]);
return (
From 025ffe7d96eb30d6f1625ff6171bbe8153776dee Mon Sep 17 00:00:00 2001
From: Marvin Hagemeister
Date: Sun, 1 Mar 2020 06:51:26 +0100
Subject: [PATCH 30/37] Restructure categories
---
src/config.json | 56 ++++++++++++++++++++++++-------------------------
1 file changed, 28 insertions(+), 28 deletions(-)
diff --git a/src/config.json b/src/config.json
index 7cae39793..6deda1be0 100644
--- a/src/config.json
+++ b/src/config.json
@@ -245,6 +245,10 @@
"pt-br": "Fazendo upgrade do 8.x",
"de": "Migration von 8.x"
}
+ },
+ {
+ "path": "/guide/v10/tutorial",
+ "name": "Tutorial"
}
]
},
@@ -253,10 +257,6 @@
"en": "Essentials"
},
"routes": [
- {
- "path": "/guide/v10/tutorial",
- "name": "Tutorial"
- },
{
"path": "/guide/v10/components",
"name": {
@@ -265,14 +265,6 @@
"de": "Komponenten"
}
},
- {
- "path": "/guide/v10/extending-component",
- "name": {
- "en": "Extending Component",
- "pt-br": "Extendendo Componentes",
- "de": "Komponente Erweitern"
- }
- },
{
"path": "/guide/v10/hooks",
"name": "Hooks"
@@ -300,7 +292,14 @@
"pt-br": "Contexto",
"de": "Kontext"
}
- },
+ }
+ ]
+ },
+ {
+ "name": {
+ "en": "Debug & Test"
+ },
+ "routes": [
{
"path": "/guide/v10/debugging",
"name": {
@@ -308,6 +307,14 @@
"pt-br": "Ferramentas de depuração",
"de": "Entwickler-Tools"
}
+ },
+ {
+ "path": "/guide/v10/unit-testing-with-enzyme",
+ "name": {
+ "en": "Unit Testing with Enzyme",
+ "pt-br": "Teste unitario com Enzyme",
+ "de": "Unit-Tests mit Enzyme"
+ }
}
]
},
@@ -334,21 +341,6 @@
}
]
},
- {
- "name": {
- "en": "Testing"
- },
- "routes": [
- {
- "path": "/guide/v10/unit-testing-with-enzyme",
- "name": {
- "en": "Unit Testing with Enzyme",
- "pt-br": "Teste unitario com Enzyme",
- "de": "Unit-Tests mit Enzyme"
- }
- }
- ]
- },
{
"name": {
"en": "Advanced",
@@ -383,6 +375,14 @@
"de": "Externe DOM Mutationen"
}
},
+ {
+ "path": "/guide/v10/extending-component",
+ "name": {
+ "en": "Extending Component",
+ "pt-br": "Extendendo Componentes",
+ "de": "Komponente Erweitern"
+ }
+ },
{
"path": "/guide/v10/options",
"name": {
From 1f05c0cd2adc97eaea49ed6108146cc143721647 Mon Sep 17 00:00:00 2001
From: Marvin Hagemeister
Date: Sun, 1 Mar 2020 06:52:29 +0100
Subject: [PATCH 31/37] Delete "Extending Component" page
---
content/en/guide/v10/extending-component.md | 67 ------------------
.../pt-br/guide/v10/extending-component.md | 68 -------------------
src/config.json | 8 ---
3 files changed, 143 deletions(-)
delete mode 100755 content/en/guide/v10/extending-component.md
delete mode 100755 content/pt-br/guide/v10/extending-component.md
diff --git a/content/en/guide/v10/extending-component.md b/content/en/guide/v10/extending-component.md
deleted file mode 100755
index a6e8f3267..000000000
--- a/content/en/guide/v10/extending-component.md
+++ /dev/null
@@ -1,67 +0,0 @@
----
-name: Extending Component
-permalink: '/guide/extending-component'
----
-
-# Extending Component
-
-It is possible that some projects would wish to extend Component with additional functionality.
-
-There are varying opinions on the value of inheritance in JavaScript, but if you wish to build your own "base class" from which all of your components inherit, Preact has you covered.
-
-Perhaps you want to do automatic connection to stores/reducers within a Flux-like architecture. Maybe you want to add property-based mixins to make it feel more like `React.createClass()` _(note: the [`@bind` decorator](https://github.com/developit/decko#bind) is preferable)_.
-
-In any case, just use ES2015 class inheritance to extend Preact's `Component` class:
-
-```jsx
-class BoundComponent extends Component {
- // example: get bound methods
- binds() {
- let list = this.bind || [],
- binds = this._binds;
- if (!binds) {
- binds = this._binds = {};
- for (let i=list.length; i--; ) {
- binds[list[i]] = this[list[i]].bind(this);
- }
- }
- return binds;
- }
-}
-```
-
-Example Usage:
-
-```jsx
-class Link extends BoundComponent {
- bind = ['click'];
- click() {
- open(this.props.href);
- }
- render({ children }) {
- let { click } = this.binds();
- return { children };
- }
-}
-
-render(
- Click Me,
- document.body
-);
-```
-
-
-The possibilities are endless. Here's an extended `Component` class that supports rudimentary mixins:
-
-```jsx
-class MixedComponent extends Component {
- constructor() {
- super();
- (this.mixins || []).forEach( m => Object.assign(this, m) );
- }
-}
-```
-
----
-
-> **Footnote:** It's worth noting that inheritance can lock you into brittle parent-child relationships. Often when faced with a programming task that can be solved adequately with inheritance, there is a more functional way to achieve the same goal that would avoid creating such a relationship.
diff --git a/content/pt-br/guide/v10/extending-component.md b/content/pt-br/guide/v10/extending-component.md
deleted file mode 100755
index 759861de7..000000000
--- a/content/pt-br/guide/v10/extending-component.md
+++ /dev/null
@@ -1,68 +0,0 @@
----
-name: Extendendo Componentes
-permalink: '/guide/extending-component'
----
-
-# Extendendo Componentes
-
-É possível que alguns projetos queiram extender `Component` com funcionalidade adicional.
-
-Opniões sobre o valor da herança em JavaScript são variadas, mas se você deseja criar sua própria "class base" da qual todos os seus componentes herdem, Preact tem o que você precisa.
-
-Talvez você queira fazer conexão automática a `stores`/`reducers` dentro de uma arquitetura Flux. Talvez você queira adicionar _mixins_ baseados em propriedades para o fazer mais parecido com o `React.createClass()` _(nota: o [decorador `@bind`](https://github.com/developit/decko#bind) é preferível)_.
-
-Em qualquer caso, apenas use a herança de classes do ES2015 para extender a class `Component` do Preact:
-
-
-```js
-class BoundComponent extends Component {
- // Exemplo: obter métodos vinculados
- binds() {
- let list = this.bind || [],
- binds = this._binds;
- if (!binds) {
- binds = this._binds = {};
- for (let i=list.length; i--; ) {
- binds[list[i]] = this[list[i]].bind(this);
- }
- }
- return binds;
- }
-}
-```
-
-Exemplo de uso:
-
-```jsx
-class Link extends BoundComponent {
- bind = ['click'];
- click() {
- open(this.props.href);
- }
- render({ children }) {
- let { click } = this.binds();
- return { children };
- }
-}
-
-render(
- Click Me,
- document.body
-);
-```
-
-As possibilidades são sem fim. Aqui, uma class `Componente` que suporta _mixins_ rudimentares:
-
-
-```js
-class MixedComponent extends Component {
- constructor() {
- super();
- (this.mixins || []).forEach( m => Object.assign(this, m) );
- }
-}
-```
-
----
-
-> **Nota:** Vale a pena atentar-se de que a herança pode te prender em relacões _parent-child_ frágeis. Frequentemente quando encontra-se uma tarefa que pode ser resolvida com herança há uma maneira mais funcional de alcançar o mesmo objetivo que evitaria a criação de tal relacionamento.
diff --git a/src/config.json b/src/config.json
index 6deda1be0..63ea159ac 100644
--- a/src/config.json
+++ b/src/config.json
@@ -375,14 +375,6 @@
"de": "Externe DOM Mutationen"
}
},
- {
- "path": "/guide/v10/extending-component",
- "name": {
- "en": "Extending Component",
- "pt-br": "Extendendo Componentes",
- "de": "Komponente Erweitern"
- }
- },
{
"path": "/guide/v10/options",
"name": {
From e30c35580465e15fb694d3b77ae53aac3f66da9d Mon Sep 17 00:00:00 2001
From: "size-plugin[bot]" <52573255+size-plugin[bot]@users.noreply.github.com>
Date: Sun, 1 Mar 2020 06:07:37 +0000
Subject: [PATCH 32/37] =?UTF-8?q?=F0=9F=9B=A3=EF=B8=8F=20=F0=9F=91=99=20up?=
=?UTF-8?q?date=20size-plugin-ssr.json=20=F0=9F=91=8D?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
size-plugin-ssr.json | 20 ++++++++++----------
1 file changed, 10 insertions(+), 10 deletions(-)
diff --git a/size-plugin-ssr.json b/size-plugin-ssr.json
index e48b6c224..2c0bb125c 100644
--- a/size-plugin-ssr.json
+++ b/size-plugin-ssr.json
@@ -1,6 +1,6 @@
[
{
- "timestamp": 1583009206563,
+ "timestamp": 1583042762439,
"files": [
{
"filename": "editor.chunk.*****.js",
@@ -22,9 +22,9 @@
},
{
"filename": "ssr-bundle.js",
- "previous": 28292,
- "size": 28603,
- "diff": 311
+ "previous": 28603,
+ "size": 29330,
+ "diff": 727
},
{
"filename": "markdown.c9960.worker.js",
@@ -51,16 +51,16 @@
"diff": 0
},
{
- "filename": "ssr-bundle.bb7c2.css",
- "previous": 11875,
+ "filename": "ssr-bundle.db1a2.css",
+ "previous": 12113,
"size": 0,
- "diff": -11875
+ "diff": -12113
},
{
- "filename": "ssr-bundle.db1a2.css",
+ "filename": "ssr-bundle.2a517.css",
"previous": 0,
- "size": 12113,
- "diff": 12113
+ "size": 12287,
+ "diff": 12287
}
]
}
From 6efc1be0b3ef9a2f340d05b91c8fc4c24b9af940 Mon Sep 17 00:00:00 2001
From: "size-plugin[bot]" <52573255+size-plugin[bot]@users.noreply.github.com>
Date: Sun, 1 Mar 2020 06:07:39 +0000
Subject: [PATCH 33/37] =?UTF-8?q?=F0=9F=8D=87=20=F0=9F=A6=BC=20update=20si?=
=?UTF-8?q?ze-plugin-browser.json=20=F0=9F=91=8D?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
size-plugin-browser.json | 54 ++++++++++++++++++++--------------------
1 file changed, 27 insertions(+), 27 deletions(-)
diff --git a/size-plugin-browser.json b/size-plugin-browser.json
index 11685aed0..ea722654c 100644
--- a/size-plugin-browser.json
+++ b/size-plugin-browser.json
@@ -1,6 +1,6 @@
[
{
- "timestamp": 1583009286936,
+ "timestamp": 1583042842113,
"files": [
{
"filename": "sw-esm.js",
@@ -98,18 +98,6 @@
"size": 5912,
"diff": 0
},
- {
- "filename": "bundle.4b143.css",
- "previous": 9383,
- "size": 0,
- "diff": -9383
- },
- {
- "filename": "bundle.32272.esm.js",
- "previous": 23849,
- "size": 0,
- "diff": -23849
- },
{
"filename": "5.chunk.429c6.css",
"previous": 1483,
@@ -122,12 +110,6 @@
"size": 3381,
"diff": 0
},
- {
- "filename": "bundle.6cb92.js",
- "previous": 24263,
- "size": 0,
- "diff": -24263
- },
{
"filename": "5.chunk.13309.js",
"previous": 3455,
@@ -136,21 +118,39 @@
},
{
"filename": "bundle.605e4.css",
- "previous": 0,
- "size": 9560,
- "diff": 9560
+ "previous": 9560,
+ "size": 0,
+ "diff": -9560
},
{
"filename": "bundle.89cbb.esm.js",
- "previous": 0,
- "size": 24191,
- "diff": 24191
+ "previous": 24191,
+ "size": 0,
+ "diff": -24191
},
{
"filename": "bundle.cf3a7.js",
+ "previous": 24615,
+ "size": 0,
+ "diff": -24615
+ },
+ {
+ "filename": "bundle.7bfa4.css",
+ "previous": 0,
+ "size": 9684,
+ "diff": 9684
+ },
+ {
+ "filename": "bundle.6b182.esm.js",
+ "previous": 0,
+ "size": 24811,
+ "diff": 24811
+ },
+ {
+ "filename": "bundle.c4f1c.js",
"previous": 0,
- "size": 24615,
- "diff": 24615
+ "size": 25242,
+ "diff": 25242
}
]
}
From d36782e58e45fcad350e9a8b7f2d2e3e82c0167a Mon Sep 17 00:00:00 2001
From: 38elements <38elements@users.noreply.github.com>
Date: Sun, 1 Mar 2020 22:26:44 +0900
Subject: [PATCH 34/37] Fix options.event description
---
content/en/guide/v10/options.md | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/content/en/guide/v10/options.md b/content/en/guide/v10/options.md
index 00a56b5df..3fe4050b5 100644
--- a/content/en/guide/v10/options.md
+++ b/content/en/guide/v10/options.md
@@ -68,9 +68,9 @@ Invoked immediately after a vnode is rendered, once its DOM representation is co
#### `options.event`
-**Signature:** `(event: Event) => void`
+**Signature:** `(event: Event) => any`
-Invoked just before a DOM event is handled by its associated Virtual DOM listener.
+Invoked just before a DOM event is handled by its associated Virtual DOM listener. When `options.event` is setted, the event which is event listener argument is replaced return value of `options.event`.
#### `options.requestAnimationFrame`
From de3d9a8bfa013c7367ef5026cd975fbf6e0cfac5 Mon Sep 17 00:00:00 2001
From: Marvin Hagemeister
Date: Mon, 2 Mar 2020 09:54:26 +0100
Subject: [PATCH 35/37] Remove all references to react devtools
---
content/de/index.md | 1 -
content/en/index.md | 1 -
content/fr/index.md | 1 -
content/it/index.md | 1 -
content/pt-br/guide/v10/debugging.md | 21 +++++++++++----------
content/pt-br/index.md | 1 -
content/tr/index.md | 1 -
7 files changed, 11 insertions(+), 16 deletions(-)
diff --git a/content/de/index.md b/content/de/index.md
index ef1e69762..243e1a06c 100755
--- a/content/de/index.md
+++ b/content/de/index.md
@@ -112,7 +112,6 @@ function Counter() {
`props`, `state` und `context` werden zu `render()` weitergegeben
Standard HTML-Attribute (z.B. `class` und `for`) können verwendet werden
-
Funktioniert ohne jegliche Modifikation mit React DevTools
diff --git a/content/en/index.md b/content/en/index.md
index 64c1eaabf..beec407b9 100755
--- a/content/en/index.md
+++ b/content/en/index.md
@@ -110,7 +110,6 @@ function Counter() {
props, state and context are passed to render()
Use standard HTML attributes like class and for
-
Works with React DevTools right out of the box
diff --git a/content/fr/index.md b/content/fr/index.md
index 977eb2f7b..fb6c1bb9f 100755
--- a/content/fr/index.md
+++ b/content/fr/index.md
@@ -112,7 +112,6 @@ function Counter() {
Les `props`, `state` et `context` sont passés en arguments de la méthode `render()`
Les attributs standards HTML comme `class` et `for` peuvent être utilisés
-
Fonctionnne avec React DevTools sans effort
diff --git a/content/it/index.md b/content/it/index.md
index c2723fd87..5e0fcb896 100755
--- a/content/it/index.md
+++ b/content/it/index.md
@@ -117,7 +117,6 @@ function Counter() {
`props`, `state` e `context` sono passati a `render()`
Usa attributi standard dell' HTML come `class` e `for`
-
Funziona con React DevTools senza alcuna configurazione
diff --git a/content/pt-br/guide/v10/debugging.md b/content/pt-br/guide/v10/debugging.md
index d0f85e257..07cf58322 100644
--- a/content/pt-br/guide/v10/debugging.md
+++ b/content/pt-br/guide/v10/debugging.md
@@ -7,7 +7,7 @@ description: 'Como debugar aplicativos preact quando algo der errado.'
O Preact é fornecido com muitas ferramentas para facilitar a depuração. Eles são empacotados em uma única importação e podem ser incluídos importando `preact / debug`.
-Isso inclui uma ponte para a excelente [React Developer Tools] Extenção para o Chrome e Firefox. Se você já os tiver instalado, pode **experimentá-lo neste site.** Basta abrir os devtools e começar a inspecionar como o construímos.
+Isso inclui uma ponte para a excelente [Preact Developer Tools] Extenção para o Chrome e Firefox. Se você já os tiver instalado, pode **experimentá-lo neste site.** Basta abrir os devtools e começar a inspecionar como o construímos.
imprimiremos um aviso ou erro sempre que detectarmos algo errado, como aninhamento incorreto nos elementos `
`.
@@ -19,10 +19,11 @@ imprimiremos um aviso ou erro sempre que detectarmos algo errado, como aninhamen
## Intalação
-O [React Developer Tools] pode ser instalado no loja de extensões do seu navegador.
+O [Preact Developer Tools] pode ser instalado no loja de extensões do seu navegador.
-- [Para o Chrome](https://chrome.google.com/webstore/detail/react-developer-tools/fmkadmapgofadopljbjfkapdkoienihi)
-- [Para o Firefox](https://addons.mozilla.org/en-US/firefox/addon/react-devtools/)
+- [Para o Chrome](https://chrome.google.com/webstore/detail/preact-developer-tools/ilcajpmogmhpliinlbcdebhbcanbghmd)
+- [Para o Firefox](https://addons.mozilla.org/en-US/firefox/addon/preact-devtools/)
+- [Para o Edge](https://microsoftedge.microsoft.com/addons/detail/hdkhobcafnfejjieimdkmjaiihkjpmhk)
Uma vez instalado, precisamos importar o `preact / debug` em algum lugar para inicializar a conexão com a extensão. Verifique se essa importação é **a primeira** importação em todo o aplicativo.
@@ -175,11 +176,11 @@ function Foo() {
Com o Preact X, fizemos algumas mudanças no formato interno do 'vnode'.
-| Preact 8.x | Preact 10.x |
-|---|---|
-| `vnode.nodeName` | `vnode.type` |
-| `vnode.attributes` | `vnode.props` |
-| `vnode.children` | `vnode.props.children`|
+| Preact 8.x | Preact 10.x |
+| ------------------ | ---------------------- |
+| `vnode.nodeName` | `vnode.type` |
+| `vnode.attributes` | `vnode.props` |
+| `vnode.children` | `vnode.props.children` |
### Encontrou filhos com a mesmas chaves
@@ -208,4 +209,4 @@ const pessoas = [
```
-[React Developer Tools]: https://github.com/facebook/react/tree/master/packages/react-devtools
+[React Developer Tools]: https://preactjs.github.io/preact-devtools/
diff --git a/content/pt-br/index.md b/content/pt-br/index.md
index 1648cfcf5..6a972e34f 100755
--- a/content/pt-br/index.md
+++ b/content/pt-br/index.md
@@ -108,7 +108,6 @@ function Counter() {
`props`, `state` e `context` são passados pro `render()` como parâmetro
Uso de atributos HTML padrão como `class` e `for`
-
Funciona com o React DevTools sem nenhuma configuração adicional
diff --git a/content/tr/index.md b/content/tr/index.md
index ab5771157..33542e341 100755
--- a/content/tr/index.md
+++ b/content/tr/index.md
@@ -119,7 +119,6 @@ function Counter() {
`props`, `state` ve `context` zaten `render()`'a paslanmış durumda.
`class` ve `for` gibi standart HTML attribute'larını kullanabilirsiniz.
-
Kutudan çıktığı gibi React DevTools ile çalışır.
From 560d59a0304d827aed3b7d3b5dd4b2be28c38656 Mon Sep 17 00:00:00 2001
From: 38elements <38elements@users.noreply.github.com>
Date: Mon, 2 Mar 2020 19:37:46 +0900
Subject: [PATCH 36/37] Fix link
---
content/pt-br/guide/v10/debugging.md | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/content/pt-br/guide/v10/debugging.md b/content/pt-br/guide/v10/debugging.md
index 07cf58322..e10cb5226 100644
--- a/content/pt-br/guide/v10/debugging.md
+++ b/content/pt-br/guide/v10/debugging.md
@@ -7,7 +7,7 @@ description: 'Como debugar aplicativos preact quando algo der errado.'
O Preact é fornecido com muitas ferramentas para facilitar a depuração. Eles são empacotados em uma única importação e podem ser incluídos importando `preact / debug`.
-Isso inclui uma ponte para a excelente [Preact Developer Tools] Extenção para o Chrome e Firefox. Se você já os tiver instalado, pode **experimentá-lo neste site.** Basta abrir os devtools e começar a inspecionar como o construímos.
+Isso inclui uma ponte para a excelente [Preact Devtools] Extenção para o Chrome e Firefox. Se você já os tiver instalado, pode **experimentá-lo neste site.** Basta abrir os devtools e começar a inspecionar como o construímos.
imprimiremos um aviso ou erro sempre que detectarmos algo errado, como aninhamento incorreto nos elementos `
`.
@@ -19,7 +19,7 @@ imprimiremos um aviso ou erro sempre que detectarmos algo errado, como aninhamen
## Intalação
-O [Preact Developer Tools] pode ser instalado no loja de extensões do seu navegador.
+O [Preact Devtools] pode ser instalado no loja de extensões do seu navegador.
- [Para o Chrome](https://chrome.google.com/webstore/detail/preact-developer-tools/ilcajpmogmhpliinlbcdebhbcanbghmd)
- [Para o Firefox](https://addons.mozilla.org/en-US/firefox/addon/preact-devtools/)
@@ -209,4 +209,4 @@ const pessoas = [
```
-[React Developer Tools]: https://preactjs.github.io/preact-devtools/
+[Preact Devtools]: https://preactjs.github.io/preact-devtools/
From cae4bb3382fd11ca02f5498d85a8f42d6ecfc6c9 Mon Sep 17 00:00:00 2001
From: Vinci Rufus
Date: Mon, 2 Mar 2020 18:34:50 +0000
Subject: [PATCH 37/37] reminder to call the script as a module (#556)
* reminder to call the script as a module
* Some suggestions to clarify without-build-tools usage
* Update getting-started.md
* Update getting-started.md
* Update getting-started.md
Co-authored-by: Jason Miller
---
content/en/guide/v10/getting-started.md | 80 ++++++++++++++-----------
1 file changed, 44 insertions(+), 36 deletions(-)
diff --git a/content/en/guide/v10/getting-started.md b/content/en/guide/v10/getting-started.md
index a84d6951b..7285aabe2 100644
--- a/content/en/guide/v10/getting-started.md
+++ b/content/en/guide/v10/getting-started.md
@@ -5,9 +5,9 @@ description: "How to get started with Preact. We'll learn how to setup the tooli
# Getting Started
-This guide helps you get up and running to start developing Preact apps. There are 3 popular ways to do so.
+This guide helps you get up and running to start developing Preact apps.
-If you're just starting out we highly recommend going with [preact-cli](#best-practices-powered-with-preact-cli).
+There are 3 popular options. If you're new to Preact, we recommend starting with [Preact CLI](#best-practices-powered-by-preact-cli).
---
@@ -17,78 +17,86 @@ If you're just starting out we highly recommend going with [preact-cli](#best-pr
## No build tools route
-Preact has always been readily packaged to be used right in the browser. This doesn't require any build tools at all.
+Preact is packaged to be used directly in the browser, and doesn't require any build or tools:
-```js
-import { h, Component, render } from 'https://unpkg.com/preact?module';
-
-// Create your app
-const app = h('div', null, 'Hello World!');
+```html
+
```
-The only difference is that you cannot use JSX, because JSX needs to be transpiled. We got you covered with an alternative in the next section. So keep reading.
+[🔨 Edit on Glitch](https://glitch.com/~preact-no-build-tools)
+
+The primary drawback of developing this way is the lack of JSX, which requires a build step. An ergonomic and performant alternative to JSX is documented in the next section.
### Alternatives to JSX
-Writing raw `h` or `createElement` calls all the time is much less fun than using something JSX-like. JSX has the advantage of looking similar to HTML, which makes it easier to understand for many developers in our experience. It requires a built-step though, so we highly recommend an alternative called [htm].
+Writing raw `h` or `createElement` calls can be tedious. JSX has the advantage of looking similar to HTML, which makes it easier to understand for many developers in our experience. JSX requires a built-step though, so we highly recommend an alternative called [HTM][htm].
-In a nutshell [htm] can be best described as: JSX-like syntax in plain JavaScript without a need for a transpiler. Instead of using a custom syntax it relies on native tagged template strings which were added to JavaScript a while back.
+[HTM][htm] is a JSX-like syntax that works in standard JavaScript. Instead of requiring a build step, it uses JavaScript's own [Tagged Templates](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Template_literals#Tagged_templates) syntax, which was added in 2015 and is supported in [all modern browsers](https://caniuse.com/#feat=template-literals). This is an increasingly popular way to write Preact apps, since there are fewer moving parts to understand than a traditional front-end build tooling setup.
-```js
-import { h, Component, render } from 'https://unpkg.com/preact?module';
-import htm from 'https://unpkg.com/htm?module';
+```html
+
```
-It's a very popular way of writing Preact apps and we highly recommend checking out htm's [README][htm] file if you're interested in going with this route.
+[🔨 Edit on Glitch](https://glitch.com/~preact-with-htm)
+
+For more information on HTM, check out its [documentation][htm].
-## Best practices powered with `preact-cli`
+## Best practices powered by Preact CLI
-The `preact-cli` project is a ready made solution to bundle Preact applications with the optimal bundler configuration that's best for modern web application. It's built on standard tooling projects like `webpack`, `babel` and `postcss`. Because of the simplicity this is the most popular way to use Preact among our users.
+[Preact CLI] is an off-the-shelf solution for building Preact applications that is optimized for modern web development. It's built on standard tooling projects like Webpack, Babel and PostCSS. Preact CLI does not require any configuration or prior knowledge to get started, and this simplicity makes it the most popular way to use Preact.
-As the name implies, `preact-cli` is a **c**ommand-**li**ne tool that can be run in the terminal on your machine. Install it globally by running:
+As the name implies, Preact CLI is a **c**ommand-**li**ne tool that can be run in the terminal on your machine. Install it globally by running:
```bash
npm install -g preact-cli
```
-After that you'll have a new command in your terminal called `preact`. With it you can create a new application by executing the following command:
+After that you'll have a new command in your terminal called `preact`. With it you can create a new application by running the `preact create` command:
```bash
preact create default my-project
```
-The above command pulls the template from `preactjs-templates/default`, prompts for some information, and generates the project at `./my-project/`.
+This will create a new application based on our [default template](https://github.com/preactjs-templates/default). You will be asked for some information about your project, which will then be generated in the directory you specified (`my-project` in this case).
-> Tip: Any Github repo with a `'template'` folder can be used as a custom template: `preact create /`
+> **Tip:** Any GitHub repository with a `template/` folder can be used as a custom template:
+>
+> `preact create /`
### Getting ready for development
-Now we're ready to start our application. To fire up the development server run the following command inside the freshly generated project folder (`my-project` in this example):
+Now we're ready to start our application. To start a development server, run the following command inside your newly generated project folder (`my-project` from above):
```bash
# Go into the generated project folder
-cd my-project/
+cd my-project
-# Start the devserver
+# Start a development server
npm start
```
-Once the server is up you can access your app at the URL that was printed in the console. Now you're ready to develop your app!
+Once the server has started, it will print a local development URL to open in your browser.
+Now you're ready to start coding your app!
### Making a production build
-There comes a time when you need to deploy your app somewhere. The CLI ships with a handy `build` command which will generate a highly optimized build.
+There comes a time when you need to deploy your app somewhere. The CLI ships with a handy `build` command which will generate a highly optimized production build.
```bash
npm run build
@@ -96,7 +104,7 @@ npm run build
Upon completion you'll have a new `build/` folder which can be deployed directly to a server.
-> For a full list of all available commands check out the list in preact-cli's [README file](https://github.com/preactjs/preact-cli#cli-options).
+> For a full list of all available commands check out the [Preact CLI Documentation](https://github.com/preactjs/preact-cli#cli-options).
## Integrating Into An Existing Pipeline
@@ -117,7 +125,7 @@ To transpile JSX you need a babel plugin that converts it to valid JavaScript co
}
```
-> [babeljs](https://babeljs.io/) has one of the best documentation out there. We highly recommend checking it out for questions surrounding babel and how to set it up.
+> [babeljs](https://babeljs.io/) has some of the best documentation out there. We highly recommend checking it out for questions surrounding babel and how to set it up.
### Aliasing React to Preact
@@ -175,4 +183,4 @@ jest configuration:
```
[htm]: https://github.com/developit/htm
-
+[Preact CLI]: https://github.com/preactjs/preact-cli