Skip to content

Commit

Permalink
[docs] clarify the component/RouteResolver distinction
Browse files Browse the repository at this point in the history
  • Loading branch information
pygy committed May 10, 2018
1 parent c335aa7 commit d13a61a
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion docs/route.md
Original file line number Diff line number Diff line change
Expand Up @@ -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}`

Expand Down

0 comments on commit d13a61a

Please sign in to comment.