I bet you can understand NgRx after watching this video

Поделиться
HTML-код
  • Опубликовано: 23 дек 2024

Комментарии • 176

  • @JoshuaMorony
    @JoshuaMorony  Год назад +1

    Join my mailing list for more exclusive content and access to the archive of my private tips of the week: mobirony.ck.page/4a331b9076

  • @sfspmusic
    @sfspmusic Год назад +16

    I had a coding task where I had to use NGRX and absolutely no time. So I chose the shortest tutorial, which was this video, and managed to get a grasp of the concept, and do the task. So I want to thank you, Joshua for making this quick and dirty video.

  • @muhammadmanzarabbas8065
    @muhammadmanzarabbas8065 Год назад +6

    Best Ever explanation on the internet,
    22 WORTHY MINUTES FOR SURE .

  • @drissaitkassimusic
    @drissaitkassimusic Год назад +3

    He is not lying that was a damn good explanation 👍

  • @JBuchmann
    @JBuchmann 2 года назад +23

    This is perfect, thank you! I love how all the code is pre-written and you just walk us through the steps. And a sample app that is simple enough to make it not so confusing.
    As someone using Angular for 5 years, and managing state with RxJs and services, switching to NgRx is a real challenge mentally. It's a totally different way of thinking about state. But this is the general way it works in other frameworks, so it's good to know in Angular also.

  • @mhvd77
    @mhvd77 2 года назад +46

    These were actually a highly educational 23 minutes. Thank you!

  • @Johnathonaaron
    @Johnathonaaron 2 года назад +16

    This explanation of asynchronous api fetching was so much clearer then the ones I've been struggling with in React with Redux/Saga. Thank you.

  • @jazy3091
    @jazy3091 Год назад +2

    Sweeeet! I just found your channel bc I need to start working with ngRx on a project I'm assigned to and this is probably the best approach to explain reducers I found. Thanks a bunch, you've got a new subscriber! Pls keep on your good work.

  • @rianesterhuyse6044
    @rianesterhuyse6044 Год назад +1

    As someone just jumping back into Angular, this has been a golden resource. Thanks man!

  • @Sullivan433
    @Sullivan433 2 года назад +8

    On the project I am currently working on, there was a guy taking care of all the ngrx stuff, but now that guy is not longer working with us, so I needed to understand the basics of ngrx.
    Honestly, I analyze our code, and I didn't understand anything.
    I have watched some other videos, but I still was a bit confused.
    Now, with this video, I finally understood mostly everything, realizing it is actually really easy.
    Thanks dude, hope your great work continues helping more people in my situation!

  • @Shinee3e
    @Shinee3e 2 года назад +4

    Honestly the most complete and easy to grasp explanation of ngrx, thank you so much for making me break the glass of frontend development 😆

  • @gboyegalawal8881
    @gboyegalawal8881 Год назад +2

    Nicely done. Simple, straightforward , zero fluff.

  • @BigGingerJake
    @BigGingerJake Год назад +1

    I had never seen NgRx before I watched this video. Now I feel like I could easily implement it in a project.
    This video was very clear, concise, and extremely informative. Thank you!
    First time I've seen your content, and I've immediately subscribed. Bravo 👏

  • @drbaxr
    @drbaxr 2 года назад +5

    Thank you so much for making this video! I have been using NgRx at work for the past year, but I never really understood why I was doing the things I was doing. After watching your code walkthrough something just clicked in my head and everything suddenly made sense.
    Keep up the good work!

  • @RajibMostafiz
    @RajibMostafiz Год назад

    Loved it ! I was looking for something to get a quick understanding of NgRx and the catchy name of the video did not disappoint.

  • @aflorzy
    @aflorzy 11 месяцев назад

    Thank you for this video!! I’ve watched it probably 5 times over the past few months and this is the first time it’s fully clicked. You explained every part of it very well, I just needed to actually try it out and read their great documentation before I could get my head fully wrapped around the concept.
    I finally started implementing it in my own project this week because I know it’s an important library learn, and it’s essential to lean on standardized state management and reactivity as applications grow.
    We’re using NGRX in my job, but it has been mostly abandoned as more people touch the codebase who don’t understand how it works. Turns into a mess of random state management techniques and imperative code. I can’t wait to revive this approach in our project!

  • @rohitjagannath5331
    @rohitjagannath5331 2 года назад +1

    very concise and the author sticks to the point. We should make use of this video when we need to quickly brush up our skills on NgRx. Thanks for this video @Joshua

  • @Ch17638
    @Ch17638 2 года назад +4

    Thanks for the tutorial; I am just getting into the meat of NgRx and keep feeling like this is the work of a React developer that got so used to Redux and the benefits and decided it should be in Angular though the same benefit from Redux in Angular could be achieved by using a Mediator pattern in a much simpler way. Granted the way reducers are implemented here in the video is simple enough but I have seen some reducers in some of my client's solutions that will make a seasoned dev head spin

  • @mikeadkins9851
    @mikeadkins9851 11 месяцев назад +1

    I am preparing for an interview this morning and needed a refresher on NgRx, since it has been a couple years. My wife sent me this and I think I'm going to be okay now.

  • @rabatstadttv
    @rabatstadttv 2 года назад +1

    Excellent video, this is the first i've seen someone explain ngrx the easiest way, hope to see your next videos, thanks 😊

  • @sparshturkane2550
    @sparshturkane2550 3 года назад +1

    This was really really helpful.
    It was so easy compared to other videos i was on the verge of giving up but this video changed my outlook thanks.

  • @clouds187
    @clouds187 Год назад +1

    This really just seems like redux for angular.. I love it. I have gotten used to rxjs thanks to your well explained videos, i've even went to the point of using rxjs in react.. made me realise how powerful it is as a library, and made me even better at angular.

    • @markvanmameren
      @markvanmameren Год назад +1

      Ng = Angular
      Rx = Redux
      so yeah, NgRx = Redux for Angular

  • @dpskatoo75
    @dpskatoo75 2 года назад +2

    Very good tutorial, have watched a few others but this one is very practical and finally I can see how to get started with it. Thanks!

  • @titokris5162
    @titokris5162 3 года назад +3

    Great tutorial Josh!!! Thanks for the calm and easy to understand explanations!!! That was epic !!!!

  • @razisraeli1150
    @razisraeli1150 4 месяца назад

    What a great, great explanation Joshua! Thank you so much for this :)

  • @bestrobin01
    @bestrobin01 2 года назад +1

    Made me understand all the differenct concepts and components of NgRx! Really been struggling with understanding how it actually works. A couple of RxJs tutorials and this video made me understand everything on a whole different level!
    Great examples and structure of video.

  • @jkevinparker
    @jkevinparker 2 года назад

    This was very helpful. Even helped me understand some of what RxJS is doing in all this. Thanks!!

  • @MichaelSalo
    @MichaelSalo 2 года назад

    Your Angular code is much nicer than real world Angular code.

  • @jamienordmeyer4345
    @jamienordmeyer4345 2 года назад

    Another great video, Joshua! I've subscribed! Well done, and thank you!!

  • @Ch17638
    @Ch17638 2 года назад +1

    This is not a critique on the tutorial its very informative and to the point.
    The more I look at this pattern, it just gets progressively worse. I have seen 4 different large scale implementations on ngrx on my clients code and not one is done in an eloquent way.
    Especially reducers become massive , and trying to nav a feature while having massive reducer files ( I have seen some with 2000+ lines of code / while some split the reducer into multiple files causing even more runaround to find the one for your action).
    Maybe its just a result of poor planning and design , but If Someone can please point me to a ngrx layout that kinda make things easier to find and navigate between actions , reducers and effects I will appreciate.
    In .net core I am used to using a combination of Domain Driven Design CQRS, and MediatR and using the project layout just makes sense , you can look at a Domain(folder) , look at the filenames in the handlers folder and immediately understand what actions/commands are available on each aggregate root , without having to read through 100's of lines of code.

  • @AlainBoudard
    @AlainBoudard 3 года назад +2

    Awesome presentation., thanks Joshua !
    About the reducers part, I think it's worth mentioning that the { content } parameter is here to destruct the props that otherwise would contain also the type of the action.

    • @JoshuaMorony
      @JoshuaMorony  3 года назад +1

      Thanks Alain! And that's a great thing to mention, watching the video back I did worry that people might think that "content" was some special NgRx thing and not just a property of whatever random payload object I was sending along with the action.

    • @hansschenker
      @hansschenker 3 года назад +1

      @@JoshuaMorony I would have given the name 'todo' not 'content' - even though you only pass the name of a todo!

    • @JoshuaMorony
      @JoshuaMorony  3 года назад

      @@hansschenker yeah I think that would have been better for this example

  • @landonrivers
    @landonrivers 10 месяцев назад

    AWESOME work. Yes I DO understand NgRx now!

  • @historicallyelaine
    @historicallyelaine 2 года назад +1

    Quality work right here. Very helpful!

  • @ste9474
    @ste9474 6 месяцев назад

    This looks so cool
    Just by looking at your component code I can see this is awesome

  • @vinaysmith
    @vinaysmith Год назад

    Very helpful. Clear and concise

  • @kiranvarghese672
    @kiranvarghese672 2 года назад

    nothing can explain better than this.

  • @teckasm
    @teckasm 2 года назад

    Fantastic introduction. Thanks!

  • @LucidFabrics
    @LucidFabrics 2 года назад

    That was verry hard to work with the first time. But once implemented, it's a breeze to work with. thanks Joshua

  • @anthonydeville237
    @anthonydeville237 2 года назад

    Thanks for this clear and understandable tutorial

  • @joelmilan7835
    @joelmilan7835 Год назад

    Wish i could like it twice. Thank you very much

  • @matts9216
    @matts9216 2 года назад

    Great explanation and demo!! Logically broken down to the different parts and explained their roles. I smashed that like buttom, subscribe, and left a comment so they YT gods will bless you

  • @anj000
    @anj000 2 года назад +10

    12:17 if you are on strict mode (it is enabled by default) line 17 should be like this:
    constructor(private store: Store);
    to avoid this error with selector:
    "app.state.ts(4, 3): 'todos' is declared here."

  • @JaroNavales
    @JaroNavales Год назад

    This is great tutorial and easy to understand! Perfect and thanks!

  • @costagmc1
    @costagmc1 Год назад

    Excellent teaching, josh...

  • @user-cc8kb
    @user-cc8kb Год назад

    Thanks a lot! Will dive into it deeper now.

  • @benyaminyakobi3652
    @benyaminyakobi3652 2 года назад

    Thank you so much. Absolutely goldxgold content!

  • @MegaMaximonstre
    @MegaMaximonstre 6 месяцев назад

    Simple question (that may be convoluted): "reducers are pure functions", none the less, when creating new todo (11:44), we create an ID with a simple method, yet could be RNG stuff... So function is not so pure anymore. Is it really important for NgRx to have pure reducer functions? (caching stuff may happen).
    Thanks for great content!

  • @JBuchmann
    @JBuchmann 2 года назад +2

    With React, pretty much all devs will also know Redux. But with Angular I'll bet a good percentage don't know NgRx. If nothing else, I think getting familiar with NgRx will give Angular devs a competitive edge in the job market

  • @lioramar8465
    @lioramar8465 2 года назад

    Thanks for a very detailed tutorial! Keep it up :)

  • @RaniLink
    @RaniLink 11 месяцев назад

    Beautifully explained! thank you!

  • @_Greenflag_
    @_Greenflag_ Год назад

    18:29 why using a Promise here instead of Observable with RxJs ?

  • @gosnooky
    @gosnooky Год назад +1

    One thing I'd suggest is to keep the todo state folder under the todo tree, because you reference 'TodoService' in your effects file. This I consider an anti-pattern where narrowed application contexts (in this case the Todo context) are referenced by global contexts such as application state.

  • @franciscogiordano298
    @franciscogiordano298 2 года назад

    Joshua you are an angel sent from the Angular gods! haha

  • @ShaifulBorhan
    @ShaifulBorhan 2 года назад +5

    Hi Josh, in the TodoState you defined the "status" and "error" properties. How do we actually go about using these properties for example to show a loading spinner during loadTodos and an error message on loadTodosFailure actions? Do we have to create new selectors for each?

    • @Manuel-DaSilva
      @Manuel-DaSilva 2 года назад +1

      Usually you should create a vm selector, which is a view model selector, for that specific view, that selector should have the shape of {isLoading, error, content} and the component should handle those

  • @cburys
    @cburys Год назад

    first, Thanks! super helpful video. I have only one question, what is the 'from' call wrapping saveToDos @20:46 ?

  • @dnguyendev
    @dnguyendev Год назад

    Easily my most favorite video about NgRx

  • @thewebartist
    @thewebartist Год назад

    Absolutely fantastic. Thanks

  • @B1TCH35K1LL3R
    @B1TCH35K1LL3R 2 года назад

    great video! just one quick question:
    in the effect code (around minute 19:20) why is loadTodosSuccess being called like so while loadTodosFailure is wrapped in an "of" call?

    • @JBuchmann
      @JBuchmann 2 года назад

      I think it has something to do with it being an "error". When there is an error you want the operator flow to continue instead of ending there. So the catchError function is returning an Observable (because of the "of"). I just remember from other RxJs tutorials that in the catchError operator you still have to return an observable.

    • @TheSaintsVEVO
      @TheSaintsVEVO 11 месяцев назад +1

      I wish RUclips didn’t have a “hearts” feature on comments, so questions like these would show up instead of the channel’s hearted comments showing up at the top. Those are always just “great tutorial” or whatever and helps no one

  • @godfathermikal
    @godfathermikal 2 года назад

    great video. really helped break things down for me in my head. 🙏

  • @nt9760
    @nt9760 2 года назад +3

    Hi Joshua,
    thank you for this tutorial. I have a question. WhenI call the select method, it appears an error on the selectAllTodos parameter which was only solved when I assigned to store the type in the constructor: private store: Store.
    I found this solution on stack but on this tuto you didn't use this solution, so I want to know if it's a change to the new library?
    Also apart from the fact that we have a second state, is there any use for using AppState in the selector ?
    Thank you

    • @jasper_pa
      @jasper_pa Год назад

      Thank you for sharing your solution. I ran into the same problem and tried to find a fix for the whole day..

  • @abhik4545
    @abhik4545 2 года назад

    Very good explanation, Thank you !!

  • @wizzdizzable
    @wizzdizzable 2 года назад

    Very nice video! Thanks for a good explanation and some awesome insights!!!

  • @chunckyfreshnut
    @chunckyfreshnut 2 года назад

    Thank for the explanation. NgRx is trying to simulate a single processor taking multiple request in a stack. It is more work than it really worth. Can use Rxjs and local store to achieve the same result and faster and easier?

  • @markvanmameren
    @markvanmameren Год назад

    Awesome video!

  • @temotsuladze8018
    @temotsuladze8018 Год назад

    Thank you for this great video!

  • @Brunoalves-wi5bk
    @Brunoalves-wi5bk 2 года назад

    Can you explain why did you use promise in the api call, instead of using only observable? Cause in my head I don't see any reason so convert results to promises and them convert it back to observable

  • @mongolhvv
    @mongolhvv Год назад

    Thank you. Clear explanation ❤

  • @Iam_AndersonP
    @Iam_AndersonP 2 года назад

    Nice example, i just have a soubt, if you want to create a filter and aply that filter to the list of todos, you would create a new state for the results or it will be a new efect aply to the main todo array?

  • @seyedamirhosseinrasouli2131
    @seyedamirhosseinrasouli2131 Год назад

    A wonderful tutorial 😍

  • @subashbarik
    @subashbarik 2 года назад

    Thanks a lot , great video helped me a lot understanding the NgRx state management. I am relatively new to Angular and have one question : In a larger application since the data that will reside in the 'AppState' will be larger , it is going to affect the performance of the app.

  • @hoangtuan4592
    @hoangtuan4592 2 года назад

    Could you make a video about Angular - NX Workspace and Using Ngrx for state management?

  • @DonCadavona
    @DonCadavona 10 месяцев назад +2

    The problem with introducing complex concepts like these is that it is so hard to fit into your mind, that some think they got it, but are actually implementing it wrong, or overuses it, making the already complex concept even more unnecessarily complex, I would even call it wrong.

    • @LeviDPS
      @LeviDPS 3 месяца назад +1

      Absolutely, I’m in a mess right now where NgRX was used simply to store data from an api call and then be used across a handful of components in a single feature. Everything that is being done could have been accomplished with a single service but instead there’s reducers, effects, states and a mess of logic being thrown around just to handle get/add/remove from a list of items.

  • @robocop30301
    @robocop30301 2 года назад

    Nice explanation. Much appreciated!

  • @fatimazboujrar
    @fatimazboujrar 25 дней назад

    thank you for this amazing explantation

  • @ztamizzen
    @ztamizzen Год назад

    Excellent, this really helped me understand NgRx and made my code look a lot more elegant. ❤️
    How do you not get the TypeScript errors that I get though?!...

  • @TommiSvaerd
    @TommiSvaerd Год назад

    One thing i've struggled with when working with NGRX is how to handle data when for example you are logging in. Should I just dispatch a bunch of fetch actions in app component when user is logged in? Or should I have a side effect that listens to a loginSuccessful action and then do all dispatches there? Never found a best practice in this scenario, any advice?

  • @ezraorina100
    @ezraorina100 2 года назад

    How would you recommend the setup for ngrx when using nx

  • @thegeniusand7256
    @thegeniusand7256 2 года назад

    So informative, thanks a lot!

  • @negusdawoo
    @negusdawoo Год назад

    Is createFeatureSelector a replacement/option for appstate

  • @thanhvan3528
    @thanhvan3528 Год назад

    Thank you so much bro. Can anyone help me to show where saveTodo$ effect was trigged?

  • @rohitsanwariya7217
    @rohitsanwariya7217 2 года назад

    Just keep making this videos you are awesome

  • @johnddonnet5151
    @johnddonnet5151 2 года назад

    Can you replace it completely with basic https and RxJs services? And how you go refactoring 5 stores that uses 4 APIS for immutable data?

    • @JoshuaMorony
      @JoshuaMorony  2 года назад

      Yes you can just use standard services/RxJS for state management - NgRx is never required, it's more a question of when it makes sense to use it. I'm not sure what you mean with your second question.

  • @scottmaness3195
    @scottmaness3195 Год назад

    Thank you so much, this was super helpful!

  • @micortes89
    @micortes89 2 года назад

    This looks so elegant but it is based in some abstract concepts, and quite honestly, it is just a simple todo application (could be coded so much simpler than this).

  • @theoverself800
    @theoverself800 2 года назад

    Hello Joshua, so if I understand it, you need to dispatch in ngOnInit action like allTodos and then in code above you are listening to again all todos selector as $observable and then show data in html using | async pipe, right? and also this dispatch is listening in effects from where you get data like from api calls. So basically, there is always two listeners for one action like selector in template and also effects that listen to this kind of action.

  • @FraserMcLean81
    @FraserMcLean81 2 года назад

    Great video, thanks for sharing!

  • @giorgiozarantonello2211
    @giorgiozarantonello2211 Год назад

    hi joshua , with your video passing from react to ngrx in angular was very simple! i just can't build the code , terminal provides me a lot of errors , do you have any suggestions how to build correctly the project ? thanks

  • @SumitNirgude-z2h
    @SumitNirgude-z2h Год назад

    Hi Joshua, I am about to start a Angular project based on data integration & data pipeline. Where a new data can be created, from multiple data sources (Amazon RDS, Hadoop, PosGres, stc.) . So should I use NGRX or not ?

  • @wafel_dev
    @wafel_dev 2 года назад

    Hey Josh,
    How NgRx should be structured in apps broken down by feature modules. For example like the one from your video 'How to structure your Angular apps like a Googler' ?

    • @JoshuaMorony
      @JoshuaMorony  2 года назад +1

      Hey check out this page in the docs: ngrx.io/guide/store/feature-creators - the general idea is that you register a feature with the StoreModule.forFeature() static method - in the end your global store is basically an object storing values, and by creating a feature your feature module will get a "slice" of that global state dedicated to it (e.g. a property within that object) and that property will be named whatever you register your feature as using forFeature()

  • @rkjessop
    @rkjessop 6 месяцев назад

    I'm picking up build errors. Have there been updates since the video was made? The video seems newer than the timestamp of the repo. Another discrepancy I've noticed is that the VSC project title is not the same as the repo. The package.json seems outdated as well. I enjoy your YT presentations that take developers to the next level.

  • @anutaNYC
    @anutaNYC Год назад

    How do you call api url from the services?! I'm always confused by this pattern, where is http request?

    • @JoshuaMorony
      @JoshuaMorony  Год назад

      The general idea with this pattern is that you trigger an action when you want to load something, and you have an effect that is listening for that action. That effect triggers the HTTP request and if it is successful the effect will trigger some sort of "success" action with the data from the HTTP request as the payload, or an "error" action if it fails.

  • @simransimran6766
    @simransimran6766 Год назад

    Really nice video❤️❤️tysm

  • @danielrowe6107
    @danielrowe6107 Год назад

    Redux is probably one of the best patterns created

  • @PioneersWorld
    @PioneersWorld Месяц назад

    thanks for the content

  • @teddycristian2779
    @teddycristian2779 5 месяцев назад

    thank you very much fella

  • @victory_lucky
    @victory_lucky 2 года назад

    Well explained

  • @danielklein2694
    @danielklein2694 3 года назад

    Hi, thx for tutorial.
    I wanter to learn ngrx like 3 months ago but I didn't feel like it till I watched this video.
    But I ran into some issues.
    Right now I'm working on a school project and I'm using prisma + express as a backend but I have problem with saving all object at once I would need to call add or remove just for one item per action and not whole list / state but don't really know how to do that yet.
    Also second problem is that as you used {content:string} as a type for adding Todo I'm using interface but unfortunately I found out that actions adds that type property to object when they get dispatched and that makes me problem when I send it to the back end because type isn't defined in my interface Is it possible somehow remove that property ? i found delete fucntion from ts but i cant call it because when i loop through my last before sending in service obviously type isn't know as property since actions forcefully add's it to it.

  • @nyanya6068
    @nyanya6068 Год назад

    is this the trend in angular? should I invest learning these?

    • @JoshuaMorony
      @JoshuaMorony  Год назад +1

      Generally simpler state management solutions are used, either people rolling their own state management or simpler libraries like NgRx Component Store or Elf. The global NgRx Store outlined in this video is generally used by larger teams working on more complex apps. It's still a pattern worth learning though, this whole idea of having actions that are interpreted by reducers to change state is quite common.

    • @nyanya6068
      @nyanya6068 Год назад

      @@JoshuaMorony thank you, I think I'm going to give it a try. based on your teaching it's not that really hard to understand. and I think it's much more readable.

  • @negusdawoo
    @negusdawoo Год назад

    Very nice sir

  • @balajibalamurugan8053
    @balajibalamurugan8053 3 года назад

    does it give us more code to type ?for component we have to created 4 files ? does it give us more code to write ?\

    • @JoshuaMorony
      @JoshuaMorony  3 года назад

      There is more code to write, especially initially, but it might also save you having to write more code later in some circumstances.

    • @balajibalamurugan8053
      @balajibalamurugan8053 3 года назад

      @@JoshuaMorony later means ? do you mean in refactoring ?

    • @JoshuaMorony
      @JoshuaMorony  3 года назад +2

      @@balajibalamurugan8053 no moreso when you are continuing to build the application - it's a bit of work up front to set up the reducers, but once everything is in place you have a very streamlined and organised way to add new features

    • @balajibalamurugan8053
      @balajibalamurugan8053 3 года назад

      @@JoshuaMorony yeah ok !understood