Browse Source

s/function components/functional components (#711)

A stateless React component is referred to as a "functional component" throughout the documentation, not a "function component".
main
Chafic Najjar 7 years ago
committed by Dan Abramov
parent
commit
858d2886f9
  1. 2
      content/docs/higher-order-components.md

2
content/docs/higher-order-components.md

@ -190,7 +190,7 @@ function logProps(InputComponent) {
const EnhancedComponent = logProps(InputComponent);
```
There are a few problems with this. One is that the input component cannot be reused separately from the enhanced component. More crucially, if you apply another HOC to `EnhancedComponent` that *also* mutates `componentWillReceiveProps`, the first HOC's functionality will be overridden! This HOC also won't work with function components, which do not have lifecycle methods.
There are a few problems with this. One is that the input component cannot be reused separately from the enhanced component. More crucially, if you apply another HOC to `EnhancedComponent` that *also* mutates `componentWillReceiveProps`, the first HOC's functionality will be overridden! This HOC also won't work with functional components, which do not have lifecycle methods.
Mutating HOCs are a leaky abstraction—the consumer must know how they are implemented in order to avoid conflicts with other HOCs.

Loading…
Cancel
Save