You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: content/en/guide/v10/differences-to-react.md
-49Lines changed: 0 additions & 49 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -169,55 +169,6 @@ Ultimately, if you're looking at the generated output code for a Preact applicat
169
169
170
170
The legacy `Context` API requires Components to declare specific properties using React's `contextTypes` or `childContextTypes` in order to receive those values. Preact does not have this requirement: all Components receive all `context` properties produced by `getChildContext()` by default.
171
171
172
-
## Features exclusive to `preact/compat`
173
-
174
-
`preact/compat` is our **compat**ibility layer that translates React code to Preact. For existing React users this can be an easy way to try out Preact without changing any of your code, by [setting up a few aliases](/guide/v10/getting-started#aliasing-react-to-preact) in your bundler configuration.
175
-
176
-
### Children API
177
-
178
-
The `Children` API is a specialized set of methods for working with the value of `props.children`. For Preact this is generally unnecessary, and we recommend using the built-in array methods instead. In Preact, `props.children` is either a Virtual DOM node, an empty value like `null`, or an Array of Virtual DOM nodes. The first two cases are the simplest and most common, since it's possible to use or return `children` as-is:
For specialized cases where you need to iterate over the children passed to a component, Preact provides a `toChildArray()` method that accepts any `props.children` value and returns a flattened and normalized Array of Virtual DOM nodes.
Copy file name to clipboardExpand all lines: content/en/guide/v11/differences-to-react.md
-49Lines changed: 0 additions & 49 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -169,55 +169,6 @@ Ultimately, if you're looking at the generated output code for a Preact applicat
169
169
170
170
The legacy `Context` API requires Components to declare specific properties using React's `contextTypes` or `childContextTypes` in order to receive those values. Preact does not have this requirement: all Components receive all `context` properties produced by `getChildContext()` by default.
171
171
172
-
## Features exclusive to `preact/compat`
173
-
174
-
`preact/compat` is our **compat**ibility layer that translates React code to Preact. For existing React users this can be an easy way to try out Preact without changing any of your code, by [setting up a few aliases](/guide/v10/getting-started#aliasing-react-to-preact) in your bundler configuration.
175
-
176
-
### Children API
177
-
178
-
The `Children` API is a specialized set of methods for working with the value of `props.children`. For Preact this is generally unnecessary, and we recommend using the built-in array methods instead. In Preact, `props.children` is either a Virtual DOM node, an empty value like `null`, or an Array of Virtual DOM nodes. The first two cases are the simplest and most common, since it's possible to use or return `children` as-is:
For specialized cases where you need to iterate over the children passed to a component, Preact provides a `toChildArray()` method that accepts any `props.children` value and returns a flattened and normalized Array of Virtual DOM nodes.
Copy file name to clipboardExpand all lines: content/kr/guide/v10/differences-to-react.md
-49Lines changed: 0 additions & 49 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -168,55 +168,6 @@ React.createElement(
168
168
169
169
레거시 `Context` API는 컴포넌트가 해당 값을 받기 위해 React의 `contextTypes`나 `childContextTypes`를 사용해 특정 프로퍼티를 선언해야 합니다. 하지만 Preact는 그럴 필요가 없습니다. 모든 컴포넌트는 기본적으로 `getChildContext()`를 통해 만들어진 모든 `context` 프로퍼티를 전달받습니다.
170
170
171
-
## `preact/compat` 전용 기능
172
-
173
-
`preact/compat` 는 React 코드를 Preact로 번역해주는 Preact의 호환성 레이어(**compat**ibility layer)입니다. React 사용자가 코드를 수정하지 않고 Preact를 시도해볼 수 있는 쉬운 방법입니다. 번들러 환경 설정에 [몇가지 별칭을 세팅](/guide/v10/getting-started#aliasing-react-to-preact)하면 됩니다.
174
-
175
-
### Children API
176
-
177
-
`Children` API는 `props.children`의 값을 사용하기 위해 전문화된 메소드의 집합입니다. Preact에서는 일반적으로 불필요하며, 대신 내장 배열 메소드를 사용하기를 권장합니다. Preact에서 `props.children`은 Virtual DOM 노드나 `null`과 같은 빈값 또는 Virtual DOM node 배열입니다. 아래 두 경우는 `children`을 있는 그대로 사용하거나 리턴할 수 있기 때문에 가장 간단하고 흔한 경우입니다.
컴포넌트에 전달된 children을 반복해야 하는 특수한 경우를 위해 Preact는 `toChildArray()` 메소드를 제공합니다. `toChildArray()`는 어떠한 `props.children` 값이라도 전달받고 또한 평평하고(Flatten) 정규화된 Virtual DOM 노드 배열을 리턴합니다.
Copy file name to clipboardExpand all lines: content/pt-br/guide/v10/differences-to-react.md
-31Lines changed: 0 additions & 31 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -117,37 +117,6 @@ Na maioria dos aplicativos Preact, você encontrará `h ()`, mas suportamos ambo
117
117
118
118
A API legada `Context` exige que os Componentes implementem `contextTypes` ou `childContextTypes` no React. Com Preact, não temos essa limitação e todos os componentes recebem todas as entradas do `context`, extraídas de `getChildContext ()`.
119
119
120
-
## Funcionalidades exclusivas para `preact / compat`
121
-
122
-
`preact/compat` é a nossa camada **compat** ibilidade que traduz o código React para Preact. Para usuários existentes do React, é muito fácil experimentar o Preact apenas configurando alguns aliases na configuração do empacotador e deixando o restante do código como está.
123
-
124
-
### Children-API
125
-
126
-
A API `Children` é uma maneira especializada de iterar sobre os `children` de um componente. Para Preact, essa API não é necessária e recomendamos o uso dos métodos de arrays nativos.
127
-
128
-
```jsx
129
-
// React
130
-
functionApp(props) {
131
-
return<div>{Children.count(props.children)}</div>
132
-
}
133
-
134
-
// Preact: Converta filhos em um array e use métodos de arrays padrão.
[preact/compat] é fornecido com componentes especializados que não são necessários para todos os aplicativos. Esses incluem
143
-
144
-
-[PureComponent](/guide/v10/switching-to-preact#purecomponent): Atualiza somente se `props` e `state` foram alterados
145
-
-[memo](/guide/v10/switching-to-preact#memo): Semelhante em espírito ao `PureComponent`, mas permite usar uma função de comparação personalizada
146
-
-[forwardRef](/guide/v10/switching-to-preact#forwardRef): Forneça um `ref` para um componente filho especificado.
147
-
-[Portals](/guide/v10/switching-to-preact#portals): Continua renderizando a árvore atual em um contêiner DOM diferente
148
-
-[Suspense](/guide/v10/switching-to-preact#suspense): **experimental** Permite exibir o conteúdo de fallback caso a árvore não esteja pronta
149
-
-[lazy](/guide/v10/switching-to-preact#suspense): **experimental** Carregue o código assíncrono lazy e marque uma árvore como pronta / não pronta de acordo.
Устаревший API `Context` требует, чтобы компоненты объявляли определённые свойства, используя `contextTypes` или `childContextTypes` React, чтобы получить эти значения. У Preact нет этого требования: все компоненты по умолчанию получают все свойства `context`, созданные `getChildContext()`.
167
167
168
-
## Возможности, эксклюзивные для `preact/compat`
169
-
170
-
`preact/compat` — это наш **уровень** совместимости, который преобразует код React в Preact. Для существующих пользователей React это может быть простой способ опробовать Preact, не меняя никакого кода, путём [установки нескольких псевдонимов](/guide/v10/getting-started#псевдонимы-react-для-preact) в конфигурации вашего сборщика.
171
-
172
-
### Children API
173
-
174
-
API `Children` — это специализированный набор методов для работы со значением `props.children`. Для Preact в этом обычно нет необходимости, и вместо этого мы рекомендуем использовать встроенные методы массива. В Preact `props.children` — это либо узел Virtual DOM, пустое значение, например `null`, либо массив узлов Virtual DOM. Первые два случая являются самыми простыми и распространёнными, поскольку можно использовать или возвращать `children` как есть:
Для специальных случаев, когда необходимо перебирать дочерние элементы, переданные компоненту, в Preact предусмотрен метод `toChildArray()`, который принимает любое значение `props.children` и возвращает сглаженный и нормализованный массив узлов Virtual DOM.
Из `preact/compat` доступен React-совместимый API `Children`, позволяющий без проблем интегрироваться с существующими библиотеками компонентов.
205
-
206
-
### Специализированные компоненты
207
-
208
-
[preact/compat] поставляется со специализированными компонентами, которые необходимы не для всех приложений. К ним относятся
209
-
210
-
-[PureComponent](/guide/v10/switching-to-preact#purecomponent): Обновление происходит только в том случае, если изменились `props` или `state`.
211
-
-[memo](/guide/v10/switching-to-preact#memo): Аналогичен `PureComponent`, но позволяет использовать пользовательскую функцию сравнения.
212
-
-[forwardRef](/guide/v10/switching-to-preact#forwardref): Применение `ref` к указанному дочернему компоненту.
213
-
-[Portals](/guide/v10/switching-to-preact#portals): Продолжает рендеринг текущего дерева в другой контейнер DOM.
214
-
-[Suspense](/guide/v10/switching-to-preact#suspense-experimental): **экспериментально** Позволяет отображать резервный контент, если дерево не готово.
215
-
-[lazy](/guide/v10/switching-to-preact#suspense-experimental): **экспериментально** Отложенная загрузка асинхронного кода и пометка дерева как готового/неготового соответственно.
0 commit comments