From d13a61a4d88fac6d2b59136cffbe296b092cd96d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Pierre-Yves=20G=C3=A9rardy?= Date: Thu, 10 May 2018 09:13:57 +0200 Subject: [PATCH] [docs] clarify the component/RouteResolver distinction --- docs/route.md | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/docs/route.md b/docs/route.md index 0f253f5b..4db04e5e 100644 --- a/docs/route.md +++ b/docs/route.md @@ -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}`