Reputation: 1197
I have an Angular 4 application, implemented using the redux architecture with this library https://github.com/ngrx/platform. I want to use some custom React components in my app. My guess is that I would have to rewrite my large Angular components into React components, as it would not be possible to embed a custom React library into already existing Angular components. Also, considering that I have not used the framework agnostic redux library, I would need to rewrite that part of my app as well, basically amounting to a whole rewrite. Am I correct in my assessment?
Upvotes: 3
Views: 2781
Reputation: 1274
You can use ReactDOM.render() to render react components inside of your angular components, or alongside them. As for the ngrx issue you can probably implement some middleware or an Angular service that can provide data to your react components. You could even make an Angular component to wrap your react components and pass them props from the ngrx store. You could also use portals in your react components to accomplish a similar goal.
This may not be the most performant solution (rewriting will almost always work better) but if you just want the functionality and the performance cost isn't too bad it should be fairly simple to implement.
Upvotes: 6