This is actually very cook. Coming from watching Ryan to watching this... Fixed a lot of my concerns. It started getting a bit more like react redux toolkit, and coming from react, I flowed easily. Thank you
That might be interesting. Most people's code isn't open source and available to see. Also best practices are subject to change so I wouldn't want it to be a pile on session based on previous knowledge.
@@BrandonRobertsDev till now, I can not take a decision which one to use, NgRx seems to have more clear entities, up-to-date angular version, more community, on the other hand, NGXS seems to be more easy to code, could you plz tell me, the reason why u prefer using NgRx
I'm not going to tell you not to use NGXS. I can only tell you that NgRx is well taken care of also and used in some of the biggest Angular projects around including ones inside Google.
I haven't used ngrx/store in a couple of years cause i've switched to component-store and I must say I'm blown away by what it became!! I think you convinced me in 40min to switched back to ngrx/store :D Also, you mentioned the inject() allowing easier testing, do you have any content (articles, videos...) about testing modern ngrx? Thanks for sharing Brandon!
Thanks Kevin! Glad you find ComponentStore meets your needs also! I don't have any blog posts or videos on testing the functional effects yet, but essentially its a function that returns an observable. For example: someEffect$ = createEffect((actions$ = inject(Actions)) => actions$, { functional: true }) could be called in a test as someEffect(mockActions$) So you can pass in all the mocked dependencies upfront without using the TestBed
It doesn't change anything about how you use ComponentStore, as its just another thing you can inject. This is showing what you could do, but you don't have to switch to doing things this way.
@@BrandonRobertsDev Is there any opinion on preference going forward from inside the team? What i really like about CS is that it makes feature stores a separate concern which then simplifies the global store and (in my mind, therefore also the domain model)
I'm probably not seeing the whole picture of this, so anyone feel free to correct me. Why would developers want to have everything in one single file? With the very basic example you are writing in this video, you already have more than 90 lines of code..., imaging in a real application where, let's say we have 10 actions, 10 reducers, and out of the 10 actions, 6 are effects... having that in one file doesn't sound smart to me. Does the expression "Divide and conquer" doesn't make sense anymore? As I said, probably I'm not seeing the full picture, and I'm forgetting something...
You're correct. The goal of the video was to highlight functional effects and it being the last piece of the puzzle to put a feature state in a single file. Think of it as a starting exercise. You can see how the pieces flow together in a single file, then move them to their respective places.
You don't have to :) moreover, in more complex enterprise apps you should probably avoid that. But this video is a great example of recent functional api additions that allow you to write succinct code. As your code grows, you are still free to split the code into chunks.
This is actually very cook. Coming from watching Ryan to watching this... Fixed a lot of my concerns. It started getting a bit more like react redux toolkit, and coming from react, I flowed easily. Thank you
wow this trick improves my codebase a lot! please share more tricks like this :)
Cool!
i think u should create a series ,where u review viewers angular and fix / teach best practice
That might be interesting. Most people's code isn't open source and available to see. Also best practices are subject to change so I wouldn't want it to be a pile on session based on previous knowledge.
Nice video, so clean and easily.... Bro as you import all when pasted the code? exactly in 32:30
What do you mean? It's VScode doing the imports unless I already had them in the file
I want to know your opinion about NGXS? which state management do you prefer to use??
I'm bias to NgRx of course but NGXS is another good option also
@@BrandonRobertsDev till now, I can not take a decision which one to use, NgRx seems to have more clear entities, up-to-date angular version, more community, on the other hand, NGXS seems to be more easy to code, could you plz tell me, the reason why u prefer using NgRx
I'm not going to tell you not to use NGXS. I can only tell you that NgRx is well taken care of also and used in some of the biggest Angular projects around including ones inside Google.
Thanks, Brandon. I did a little refactoring based on this video and it looks awesome :D
Nice!
I haven't used ngrx/store in a couple of years cause i've switched to component-store and I must say I'm blown away by what it became!! I think you convinced me in 40min to switched back to ngrx/store :D
Also, you mentioned the inject() allowing easier testing, do you have any content (articles, videos...) about testing modern ngrx?
Thanks for sharing Brandon!
Thanks Kevin! Glad you find ComponentStore meets your needs also! I don't have any blog posts or videos on testing the functional effects yet, but essentially its a function that returns an observable.
For example:
someEffect$ = createEffect((actions$ = inject(Actions)) => actions$, { functional: true })
could be called in a test as
someEffect(mockActions$)
So you can pass in all the mocked dependencies upfront without using the TestBed
How does this approach (especially when you get to the vm), impact possible uyse of ComponentStore, and is this preferred now with 15.2?
It doesn't change anything about how you use ComponentStore, as its just another thing you can inject. This is showing what you could do, but you don't have to switch to doing things this way.
@@BrandonRobertsDev Is there any opinion on preference going forward from inside the team? What i really like about CS is that it makes feature stores a separate concern which then simplifies the global store and (in my mind, therefore also the domain model)
Angular have better structure by segregation.. that looks awesome if we ignore css and spec files as like nest js🎉
Hello Brandon, can you please make a small application about angular and ngrx in a new style? can help people learn in a new way
I'll see if I can put that together
I would also love to see this repository!
@@johnc0de here's the GitHub repository I used for the example in the video
github.com/brandonroberts/single-file-ngrx
can you make video of ngrx for beginners ? and thanks you content is awesome
Thanks Mohamed! It's on my list 🙂
I'm probably not seeing the whole picture of this, so anyone feel free to correct me.
Why would developers want to have everything in one single file? With the very basic example you are writing in this video, you already have more than 90 lines of code..., imaging in a real application where, let's say we have 10 actions, 10 reducers, and out of the 10 actions, 6 are effects... having that in one file doesn't sound smart to me.
Does the expression "Divide and conquer" doesn't make sense anymore?
As I said, probably I'm not seeing the full picture, and I'm forgetting something...
You're correct. The goal of the video was to highlight functional effects and it being the last piece of the puzzle to put a feature state in a single file.
Think of it as a starting exercise. You can see how the pieces flow together in a single file, then move them to their respective places.
You don't have to :) moreover, in more complex enterprise apps you should probably avoid that. But this video is a great example of recent functional api additions that allow you to write succinct code. As your code grows, you are still free to split the code into chunks.
Well said!