coatue-oss/react2angular

Reorder the prop injection

Closed this issue · 3 comments

Hey this is a great tool and we're using this to slowly migrate from AngularJS to React.

When I use react2angular I love how it inspects propTypes to determine the input bindings so I don't have to repeat myself in the function call. However this breaks if I have injections, because I notice that injected props are undefined because I specify them in my propTypes because eslint fails otherwise. I think changing this line:

render(<Class {...this.injectedProps} {...this.props} />, this.$element[0])

to this

render(<Class {...this.props} {...this.injectedProps}/>, this.$element[0])

would fix this. it would allow me to initialize my react component with injected services without needing to specify injected props.

react2angular(MyHeader, null, ['authentication', '$state', '$stateParams'])

Hi @ajdaniel! That sound fair - PRs with tests are welcome!

Will do!