Support non Angular architectures (node for example) #3082
Replies: 5 comments 2 replies
-
Yes, had the same thoughts recently. What if I want to use the same logic within a React application? I am not really a fan of Angular but I think @ngrx applications are really well designed, using rxjs + If it should be done, the |
Beta Was this translation helpful? Give feedback.
-
Isn't NgRx an implementation of Redux for Angular? If so, then the core parts are based on the patterns of Redux, can't they be used by other languages/frameworks? |
Beta Was this translation helpful? Give feedback.
-
Thanks everyone. We have discussed doing this previously, but it would not be under the NgRx "brand" if we did do it. There is some value there, but it would be a significant effort, and I don't know if there is enough demand for it outside of just using the Redux Toolkit that has a good bit of API parity and Redux Observable. There's nothing stopping you from creating an instance of NgRx Store using an internal injector, or creating the instances manually. |
Beta Was this translation helpful? Give feedback.
-
I completely get that
Not sure either
The original point I was trying to make is that another library would basically re do what ngrx has already done (for store, actions and effects). It'd then end up in maintaining 2 code bases that are very similar which means probably more bugs, potentially one diverging from the other, etc. If it was a thing, I think it'd be a shame to end up with two code bases. Unless I misunderstood and you meant that the new one would be the core and ngrx would use that as a dependency 🤔 But yeah overall I get it and I'm not sure there are enough people interested in that to make the effort of extracting those parts of the code base. (I get it, but I'm still pretty sad about that :D !) |
Beta Was this translation helpful? Give feedback.
-
I'd personally love to see it happening. There is a strong use case for that, say we would like to implement particular calculation algorithm using actions + reducers + effects + selectors and reuse the same implementation in angular app to calculate in the browser avoiding network roundtrips, and use the same code/store for nestjs app on demand. nx.dev tools are super helpful to have all this code as a mono-repo. This guy https://github.com/derekkite/ngrx-nest tried to make it real |
Beta Was this translation helpful? Give feedback.
-
Describe any alternatives/workarounds you're currently using
https://redux-observable.js.org
Other information:
The core concept of ngrx is completely framework agnostic. It's a BehaviorSubject managing state.
But a lot of work has been put into that project to get nice type safety features and performances.
I think it'd be awesome to have that extracted and reusable for React, Vue, NestJs, Node, etc. If all the Angular bits were stripped down for the core and then just add a tiny angular wrapper to be able to declare the store and the effects the way we're already doing, it'd be neat.
In some situations, being able to use ngrx server side (little games or apps with huge state management) would be awesome. Maybe https://redux-observable.js.org is a thing but I don't think it has everything (createSelector to name one) + type safety for actions etc.
Of course, some parts would be angular only (router for example). But the core could be extracted.
If accepted, I would be willing to submit a PR for this feature
[ ] Yes (Assistance is provided if you need help submitting a pull request)
[x] No, I will probably not have time to take care of that :(
Beta Was this translation helpful? Give feedback.
All reactions