mirror of
https://github.com/odoo/owl.git
synced 2025-10-06 19:59:41 +07:00
[IMP] component: add props on root components
This is a partial revert of commit 7d249d6f09.
The reason is that this changes made it much harder to unit test
components. Before, we could simply instantiate a component
like this:
const my|Comp = new MyComponent(null, props);
and then simply test it. This commit reestablish that possibility.
This commit is contained in:
@@ -443,10 +443,14 @@ const app = new App();
|
||||
app.mount(document.body);
|
||||
```
|
||||
|
||||
The root component does not have a parent nor props. It will be setup with an
|
||||
The root component does not have a parent nor `props` (see note below). It will be setup with an
|
||||
[environment](environment.md) (either the `env` defined on its class, or a
|
||||
default empty environment).
|
||||
|
||||
Note: a root component can however be given a `props` object in its constructor,
|
||||
like this: `new App(null, {some: 'object'});`. It will not be a true `props`
|
||||
object, managed by Owl (so, for example, it will never be updated).
|
||||
|
||||
### Composition
|
||||
|
||||
The example above shows a QWeb template with a sub component. In a template,
|
||||
|
||||
Reference in New Issue
Block a user