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/docs/context.md
+2-2
Original file line number
Diff line number
Diff line change
@@ -54,7 +54,7 @@ Considere por exemplo o componente `Page` que passa as props `user` e `avatarSiz
54
54
55
55
Pode parecer redundante passar para baixo as props `user` e `avatarSize` através de vários níveis se no final apenas o componente `Avatar` realmente precisa usa-las. Além disso, é incômodo sempre que o componente `Avatar` precisar de mais props do topo, você também precisar adicionar todas elas por todos os níveis intermediários.
56
56
57
-
A única maneira de resolver este problema **sem contexto** é [atribuir o próprio componente Avatar a uma prop do componente Page](/docs/composition-vs-inheritance.html#containment), assim os componentes intermediários não precisam saber sobre a prop `user`.
57
+
Uma forma de resolver este problema **sem contexto** é [atribuir o próprio componente Avatar a uma prop do componente Page](/docs/composition-vs-inheritance.html#containment), assim os componentes intermediários não precisam saber sobre a prop `user` ou o `avatarSize`:
Copy file name to clipboardExpand all lines: content/docs/legacy-context.md
+2-2
Original file line number
Diff line number
Diff line change
@@ -152,11 +152,11 @@ If `contextTypes` is defined within a component, the following [lifecycle method
152
152
>
153
153
> As of React 16, `componentDidUpdate` no longer receives `prevContext`.
154
154
155
-
### Referencing Context in Stateless Function Components {#referencing-context-in-stateless-function-components}
155
+
### Referencing Context in Function Components {#referencing-context-in-stateless-function-components}
156
156
157
157
> This section documents a legacy API. See the [new API](/docs/context.html).
158
158
159
-
Stateless function components are also able to reference `context` if `contextTypes` is defined as a property of the function. The following code shows a `Button` component written as a stateless function component.
159
+
Function components are also able to reference `context` if `contextTypes` is defined as a property of the function. The following code shows a `Button` component written as a function component.
0 commit comments