Skip to content

Commit

Permalink
feat(*): Allow React functional components (#331)
Browse files Browse the repository at this point in the history
Angular component or directives are always passed as strings,
so checking if the passed component is a function should be
sufficient to attribute the component to React.
  • Loading branch information
pavloko authored and christopherthielen committed Oct 26, 2019
1 parent 0783c5c commit b6a296d
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion src/decorateUIRouterViewConfigs.ts
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,8 @@ hybridModule.config([
const isReactComponent = cmp =>
cmp instanceof React.Component ||
(cmp && cmp.prototype && cmp.prototype.isReactComponent) ||
(cmp && cmp.prototype && typeof cmp.prototype.render === 'function');
(cmp && cmp.prototype && typeof cmp.prototype.render === 'function') ||
(cmp && typeof cmp === 'function');

Object.keys(views).forEach(key => {
const view = views[key];
Expand Down

0 comments on commit b6a296d

Please sign in to comment.