[DOC] improve component documentation

This commit is contained in:
Géry Debongnie
2019-06-28 12:59:27 +02:00
parent 2ca42e7470
commit 50c0a4b126
+19
View File
@@ -116,11 +116,30 @@ find a template with the component name (or one of its ancestor).
type and shape of the (actual) props given to the component. If Owl mode is
`dev`, this will be used to validate the props each time the component is
created/updated. See [Props Validation](#props-validation) for more information.
```js
class Counter extends owl.Component {
static props = {
initialValue: Number,
optional: true,
};
}
```
- **`defaultProps`** (Object, optional): if given, this object define default
values for (top-level) props. Whenever `props` are given to the object, they
will be altered to add default value (if missing). Note that it does not
change the initial object, a new object will be created instead.
```js
class Counter extends owl.Component {
static defaultProps = {
initialValue: 0
};
}
```
### Methods
We explain here all the public methods of the `Component` class.