Browse Source

Mention that we don't recommend inheritance in the component doc (#487)

main
Dan Abramov 7 years ago
committed by GitHub
parent
commit
d5af622629
No known key found for this signature in database GPG Key ID: 4AEE18F83AFDEB23
  1. 2
      content/docs/reference-react-component.md

2
content/docs/reference-react-component.md

@ -33,6 +33,8 @@ class Greeting extends React.Component {
If you don't use ES6 yet, you may use the [`create-react-class`](/docs/react-api.html#createclass) module instead. Take a look at [Using React without ES6](/docs/react-without-es6.html) to learn more.
Note that **we don't recommend creating your own base component classes**. Code reuse is primarily achieved through composition rather than inheritance in React. Take a look at [these common scenarios](/docs/composition-vs-inheritance.html) to get a feel for how to use composition.
### The Component Lifecycle
Each component has several "lifecycle methods" that you can override to run code at particular times in the process. Methods prefixed with **`will`** are called right before something happens, and methods prefixed with **`did`** are called right after something happens.

Loading…
Cancel
Save