[docs] clarify the component/RouteResolver distinction

This commit is contained in:
Pierre-Yves Gérardy 2018-05-10 09:13:57 +02:00
parent c335aa70ca
commit d13a61a4d8

View file

@ -147,7 +147,11 @@ Argument | Type | Required | Description
#### RouteResolver
A RouteResolver is an object that contains an `onmatch` method and/or a `render` method. Both methods are optional, but at least one must be present. A RouteResolver is not a component, and therefore it does NOT have lifecycle methods. As a rule of thumb, RouteResolvers should be in the same file as the `m.route` call, whereas component definitions should be in their own modules.
A RouteResolver is an non-component object that contains an `onmatch` method and/or a `render` method. Both methods are optional, but at least one must be present.
If an object can be detected as a component (by the presence of a `view` method or by being a `function`/`class`), it will be treated as such even if it has `onmatch` or `render` methods. Since a RouteResolver is not a component, it does not have lifecycle methods.
As a rule of thumb, RouteResolvers should be in the same file as the `m.route` call, whereas component definitions should be in their own modules.
`routeResolver = {onmatch, render}`