NGXS - Angular State Management

Sdílet
Vložit
  • čas přidán 28. 07. 2024
  • Learn how use an exciting new state management library for Angular. In this episode, we get started with NGXS and compare it to NgRx. angularfirebase.com/lessons/n...
    - NGXS ngxs.gitbook.io/ngxs
  • Věda a technologie

Komentáře • 141

  • @amcdaniel22
    @amcdaniel22 Před 6 lety +32

    ❤️❤️❤️ the video! Thanks for building this great content and sharing with us!

    • @Fireship
      @Fireship  Před 6 lety +2

      Thanks for building a great library! Excited to see where it goes :)

    • @meridjal
      @meridjal Před 6 lety +2

      Adopting NGXS on my next project.

    • @maksimoski
      @maksimoski Před 5 lety +1

      I will update all my apps with NGXS. Austin thanks for making possible easy state management with Angular!

  • @Fireship
    @Fireship  Před 6 lety +39

    NGXS is taking the Angular world by storm - and for good reason. My goal is to get you up and running with the basics and highlight the key differences compared to NgRx.

    • @saadabbasi2063
      @saadabbasi2063 Před 6 lety +4

      Yes of course, please can you make a short course on that? so people with 0 redux or ngrx{store, effect} background can understand this completely. i guess this magic can be done in 5 videos :)

    • @Fireship
      @Fireship  Před 6 lety +15

      Yes, now that this quick start is done I hope to focus on more practical real-world uses of NGXS.

    • @saadabbasi2063
      @saadabbasi2063 Před 6 lety +2

      I guess we all will love if you do that, your way of delivering is great, straightforward and neat. And it soothes us as not very beginner but also not an expert developers.

    • @ismail7947
      @ismail7947 Před 6 lety +1

      awesome words, that would be great)

    • @101daguti
      @101daguti Před 6 lety +1

      Please create more content ngxs related!

  • @logusgraphics
    @logusgraphics Před 6 lety +3

    This is state management in Angular done right! Great video, great library.

  • @nikolabogdanic398
    @nikolabogdanic398 Před 6 lety +2

    Awesome video, thanks! I deffinetly want to see more of the NGXS.

  • @S9A6M19
    @S9A6M19 Před rokem +1

    As someone who works for a living with ngxs, you did an amazing job explaining things

  • @metalllus
    @metalllus Před 4 lety +2

    This library is really excellent at reducing the amount of boilerplate. In fact at present you can use it without dispatching actions altogether + there is a ton of other useful features e.g. for entity collections management and much more. Can't believe this is not getting more traction.

  • @yegbekarl1850
    @yegbekarl1850 Před 6 lety

    Thanks for building this great content and sharing with us!

  • @d4lep0ro
    @d4lep0ro Před 6 lety +1

    I've seen NGRX and I gotta agree there was a lot of boilerplate code, thanks for sharing this

  • @VasTamas
    @VasTamas Před 6 lety +2

    I've been using NgRx fot a time, and NgXs looks much-much better and clutter-free. Thanks for this demo :) Also, more about this topic would be nice in the future :)

    • @Fireship
      @Fireship  Před 6 lety +2

      Looking forward to some advanced NGXS stuff in the future.

  • @LeoN11rus
    @LeoN11rus Před 6 lety +5

    I Love your videos, thanks for sharing your knowledge about cool libraries :) Ngrx store was really hard for me to learn and I hated to repeat all this boilerplate stuff. Definitely will try ngxs.

    • @Fireship
      @Fireship  Před 6 lety

      Thank you! State management is difficult in general, but I think NGXS makes good progress at simplifying the implementation.

  • @CB-bu3gn
    @CB-bu3gn Před 5 lety

    Great video, I'd like to see more on NGXS. Thanks.

  • @JunraeMonCollano
    @JunraeMonCollano Před 6 lety +1

    Great video! I'm starting to love ngxs

  • @FidelGuajardo
    @FidelGuajardo Před 4 lety

    I got laid off because of covid19 and I'm seeing many more jobs for Angular than for React or Vue. Now I'm getting back to Angular since the last time I did 2.x. Thank you for showing me what's the best state management to use. Your videos are EXCELLENT.

  • @williamsbotchway2471
    @williamsbotchway2471 Před 6 lety +1

    Man many thanks for touching on this topic

  • @monkkokkalis1354
    @monkkokkalis1354 Před 6 lety +2

    H., awesome, quality video as always. I have been learning NgRx (store and effects) for the past week and I love it. I've just finished refactoring code I wrote for the application I'm making for our office with NgRx (I use Node for the Server and MongoDB for the database). My question is this: should I continue on using NgRx for state management or should I consider refactoring the code again using NgXS? What do you think? Thanks.

  • @Kinthalis
    @Kinthalis Před 6 lety +1

    Wow, boiler plate is the one thing about ngrx that make me sad. I'm going to take a closer look at this library, looks really cool!

    • @Fireship
      @Fireship  Před 6 lety

      Yeah, that's a huge issue and one main things that impresses me about NGXS. I also place a very high value on readable code.

  • @ssokurenko
    @ssokurenko Před 6 lety +1

    Great, thanks for the overview!

    • @Fireship
      @Fireship  Před 6 lety

      +Sergey Thanks for watching :)

  • @eugenblatz
    @eugenblatz Před 4 lety

    Thanks for the tutorial.
    I have notice that it is common to name the function of the action like the action itself. e.g. SetUsername -> setUsername.
    In the ConfirmOrder action you named the function confirm. Is there any special reason or are there some rule you can recommend?

  • @dannyblue54
    @dannyblue54 Před 6 lety +2

    Awesome video thanks for making it!

    • @Fireship
      @Fireship  Před 6 lety

      Thanks for making NGXS, awesome tool!

    • @dannyblue54
      @dannyblue54 Před 6 lety +1

      Austin is the mastermind I just write code :)

  • @Louis5168
    @Louis5168 Před 6 lety

    excellent! it save me a lot of efforts from ngrx boilerplates

  • @JavierCarrion
    @JavierCarrion Před 3 lety

    I am a super fan of NGXS give me more Mr. Fireship ❤️‍🔥

  • @jessyndaya9487
    @jessyndaya9487 Před 6 lety +1

    I love it... we want more and more :)

    • @Fireship
      @Fireship  Před 6 lety +1

      I'm working hard to get more videos out, thanks for watching :)

  • @mateja176
    @mateja176 Před 6 lety +2

    Amazing content as always! Can you make a video on integrating web workers in an angular app... I've heard that it is possible to load the framework entirely in a separate thread, what are the pros and cons of doing so? And I believe that web workers are going to become more powerful in terms of capabilities in the future.

    • @Fireship
      @Fireship  Před 6 lety +1

      +Mateja That would make a great video - workers are really important with the rising popularity of PWAs.

  • @ttma1046
    @ttma1046 Před 6 lety +6

    you put 'npm -i' at 2:15, it supposed to be 'npm i', is that correct?

    • @Fireship
      @Fireship  Před 6 lety +2

      Good call, you're right. Thank you.

  • @rahulvanmali1406
    @rahulvanmali1406 Před 6 lety +7

    I have never worked with state management library in angular! What should I learn first ngrx or ngxs?

    • @Fireship
      @Fireship  Před 6 lety +11

      NGXS is easier to learn if you already know Angular, while NgRx might seem more familiar if you know React/Redux.

    • @pillar6programming687
      @pillar6programming687 Před 6 lety +1

      would you ever make an angular/firebase video for drag and drop?

  • @rodrigolima206
    @rodrigolima206 Před 5 lety

    If we return direct observable from the action as in the example at the end of the video, would it give us unsubscribe? I use takewhile generally in subscribers, but if we put in the action, maybe a take (1) to stop in the first result? Or in the consuming component of the action we could put takewhile even returning in action a state? I do not know if I was clear ...

  • @melpacheco9288
    @melpacheco9288 Před 6 lety +1

    Perfect!! more please

    • @Fireship
      @Fireship  Před 6 lety

      Thanks Mel. You can count on more :)

  • @MichaelCebrian
    @MichaelCebrian Před 6 lety +2

    This definitely looks more like Angular code. I'm looking forward to using this in future projects.

  • @WayneRiesterer
    @WayneRiesterer Před 6 lety +1

    Another great video, thanks. Do you think NGXS will continue to grow in popularity now that ngrx-data is able to reduce even more boilerplate code than perhaps even NGXS?

    • @Fireship
      @Fireship  Před 6 lety +1

      That's a good question, ngrx-data removes boilerplate, but you still need to know how the library works. It's good for prototyping faster for sure. It really comes down to deciding which one you like writing code with

  • @hartnil93
    @hartnil93 Před 6 lety

    This video is realy amezing!

  • @LarsKniep
    @LarsKniep Před 6 lety +1

    wow ngxs is pretty awesome

  • @daniyalmoeen6144
    @daniyalmoeen6144 Před 2 lety

    Amazing Content 👍

  • @akashpotdar6841
    @akashpotdar6841 Před 6 lety

    In the intro u said components can get store data as an observable, but in the further video you mentioned observable returns void. Can you please pitch on this?

  • @Mystearica
    @Mystearica Před 6 lety +1

    Nice video!
    What's the extension you are using? The one that shows the charts.
    Thanks!

    • @Fireship
      @Fireship  Před 6 lety

      Redux dev tools, checkout the plugin section in the NGXS docs.

  • @shadowthehedgehog2727
    @shadowthehedgehog2727 Před 2 lety

    I’m a beginner in angular and man this is confusing lol, I need to rewatch this again. My new job uses Ngxs so I need to get good at this asap

  • @MrTrytka
    @MrTrytka Před 6 lety

    Thank you, great video. Is there a public repo for the ngxs version (Salad Project)?

    • @FunkyCodeMonkeyy
      @FunkyCodeMonkeyy Před 5 lety

      I second this question/request. The video flies through some awesome looking code. It would be odd for the code not to be available via a public repo for reference. Can we get this? Thanks!

  • @danylogudz
    @danylogudz Před 5 lety

    Hope Nx will deliver schematics for ngxs in the nearest future
    And also add it to angular console

  • @ahmedschhaider4762
    @ahmedschhaider4762 Před 4 lety

    Good Content, Thank you !!

  • @ningzedai9052
    @ningzedai9052 Před 4 lety

    Does anybody know how to use ngxs router to navigate back/forward ? There is only one action provided by ngxs for navigation which is 'Navigate' class. Does ngxs have the similar actions such 'go', 'back', 'forward' that are provided in NgRx ?

  • @karolrvn
    @karolrvn Před 5 lety

    Hi. Awesome! How is the NGXS DevTools integration these days?

  • @Rudolfnegr
    @Rudolfnegr Před 5 lety

    Hey what a color theme are u using in vs code?

  • @shivanshub
    @shivanshub Před 8 měsíci

    Thanks for the nice video. My query may sound very basic but can you tell me what that graph tool at the right window. Seems very interesting. Thanks!

  • @ibrahimmohammed3484
    @ibrahimmohammed3484 Před 6 lety

    i need an advice pls, recently i built an app and i made a heavy use of behaviour subjects inside the app to manage the data states and keep everything in sync between different components, this was based on your video about sharing data between components, so i thought that behavior subjects are more versatile than keep using inputs and outputs.
    does this have a major side effect on the app performance ?

    • @Fireship
      @Fireship  Před 6 lety +1

      Both NgRx and NGXS store are just extensions of a BehaviorSubject. That is a very common pattern, but performance depends on many factors. Memory leaks could occur if you're not unsubscribing from data where needed. Run a snapshot recording in chrome to analyze.

  • @marcialabrahantes3369
    @marcialabrahantes3369 Před 3 lety

    Any updates on NgRx vs NGXS?
    The Hooks equivalent of the Angular world hasn't kept up in terms of adoption?

  • @huyoan97
    @huyoan97 Před 6 lety

    Look awesome, thanks a lot

  • @kamalkamals
    @kamalkamals Před 6 lety

    Hello Jeff, first thank you for this tuto, and i wanna ask u about effects and ngxs, in the documentation "( {NgRx}.reducer.ts + {NgRx}.effects.ts ) ≈ {NGXS}.state.ts", so from this code we understand on ngxs the effects pattern are merged with reducers class, but i need some links to explain more about that, can u send me some documentations ?

  • @LarsKniep
    @LarsKniep Před 6 lety +2

    I keep getting the error: ERROR in node_modules/@ngxs/store/src/of-action.d.ts(1,10): error TS2305: Module '"C:/Projects/ngxsapp/node_modules/rxjs/Rx"' has no exported member 'OperatorFunction'.
    Using latest version of @angular/cli and "rxjs": "^5.5.6" according to package.json. Any idea how to fix this? thanks!

    • @ababagalamaga69
      @ababagalamaga69 Před 6 lety +3

      Lars Kniep change your rxjs version to 5.6.0-forward-compat.3 in package.json

    • @LarsKniep
      @LarsKniep Před 6 lety +1

      that worked!, thanks

  • @RosieJaneEnomar21
    @RosieJaneEnomar21 Před 5 lety

    Is there a repo for this example?

  • @behramkhan1874
    @behramkhan1874 Před 2 lety +1

    If we have service then why we need ngxs ...can anyone tell most common difference between service and ngxs.Thank u

  • @LinusBenjamin
    @LinusBenjamin Před 6 lety

    Awesome video! What is the VS Code Theme and font you are using? It looks fantastic!

  • @Joshfw892
    @Joshfw892 Před 6 lety +1

    Looks great, I've been following ngrx for a while but have been disappointed with the boilerplate and lack of documentation.

    • @Fireship
      @Fireship  Před 6 lety

      The docs for NGXS are awesome

    • @Joshfw892
      @Joshfw892 Před 6 lety

      Angular Firebase Been digging into the docs all day. I like the plugin for local storage which will be extremely useful. There was a plan with NGRX to persist data with an indexedDB but they haven't released it.

  • @ajinkyax
    @ajinkyax Před 6 lety

    ngrx is the best implementation of Redux for Angular. Thanks for this new NGXS info. Now days Im mostly working with React Redux, love FP at its best with ES6

    • @Fireship
      @Fireship  Před 6 lety

      Why is ngrx is the best implementation?

  • @jayaraut
    @jayaraut Před 2 lety

    can you tell about mocking store and state( specially @Selector()) using karma jasmine.

  • @ismail7947
    @ismail7947 Před 6 lety +1

    nice channel, watching each video, thank you)

    • @Fireship
      @Fireship  Před 6 lety

      Awesome, thanks for watching and let me know want you want to see next :)

    • @ismail7947
      @ismail7947 Před 6 lety

      im interested in new technologies, and on angular) so your content is pretty ok for me)getting lots of knowledge here

  • @rondamon4408
    @rondamon4408 Před 5 lety

    Is it the same as Akita?

  • @droidvpn8754
    @droidvpn8754 Před 7 měsíci

    What's that horizontal tree on right side?

  • @arangates
    @arangates Před 6 lety

    i have not use NgRx before in my angular as i have read medium posts that it gets much complicated to manage code as the app grows .... but i want to try NgXs ... is Redux a Prerequisite to this video ?

    • @Fireship
      @Fireship  Před 6 lety

      No, you don't need to know Redux. It uses a similar pattern, but does it in a way that feels natural for Angular developers.

    • @elixir7825
      @elixir7825 Před 6 lety

      I agree with you

  • @santhoshsg7214
    @santhoshsg7214 Před 2 lety

    Hey fireship how long it take to master it

  • @j4nch
    @j4nch Před 2 lety

    Is this on a repo somewhere? Just wanted to show a nice example of devtools to a colleague

  • @sivuyilemagutywa5286
    @sivuyilemagutywa5286 Před 6 lety +1

    very easy to manange

  • @obatdelger
    @obatdelger Před 6 lety

    Is there any strong reason to name payload of action as "payload"?. I think it's more useful to name payload as username, orderid ... etc

    • @Fireship
      @Fireship  Před 6 lety

      I've thought that also, but payload is standard for redux and that's what debuggers expect to see.

    • @obatdelger
      @obatdelger Před 6 lety

      thank you. One more question. ngxs dispatch returns observable. So I can omit pending(or loading..) and errorMessage(failure reason) states from state model. also "success", "failure" actions. Or should I keep it?

  • @aa-bh5hg
    @aa-bh5hg Před 6 lety

    less boilerplate and easy to learn like vuex. very good

    • @Fireship
      @Fireship  Před 6 lety

      Thank you. Vuex is also awesome.

    • @amcdaniel22
      @amcdaniel22 Před 6 lety

      It was heavily inspired by vuex 😊😊

  • @donnyfernandes1547
    @donnyfernandes1547 Před 5 lety

    Can you share your github link for this

  • @akhileshrai7908
    @akhileshrai7908 Před 3 lety

    Can you make one for akita state management. PLS

  • @sampsonorson
    @sampsonorson Před 2 lety

    What is the `-s` at 2:17

  • @amsakanna
    @amsakanna Před 6 lety

    Can we have a database in firestore solely for authentication and have every website I create have a primary firestore instance for storing data and a secondary firestore instance to sign in and still force database/storage rules based on this auth? This blog (given below) talks about it but scopes to just google auth provider and asks me to use server side coding for email/password. Can you make a video on how to do this for email/password authentication?
    Blog: firebase.googleblog.com/2016/12/working-with-multiple-firebase-projects-in-an-android-app.html

  • @sivagatti
    @sivagatti Před 4 lety

    why its not like vuex

  • @__renesan
    @__renesan Před 2 lety

    Gracias ♥

  • @Ram-sc6or
    @Ram-sc6or Před 3 lety

    Thanks man

  • @LorenzoDIanni
    @LorenzoDIanni Před 5 lety

    What do you think about Akita? Would be super an introduction/comparison between ngrx/ngxs in the future
    github.com/datorama/akita

  • @bsbs1927
    @bsbs1927 Před 4 lety

    My fav.

  • @aakashthakur1415
    @aakashthakur1415 Před 6 lety

    Positive for state management on the angular end.

  • @chanlito4896
    @chanlito4896 Před 6 lety

    Just like mobx for angular

    • @Fireship
      @Fireship  Před 6 lety

      Yes, definitely some similarities.

  • @Joe-ww8su
    @Joe-ww8su Před 5 lety

    Redux design pattern :)

  • @yussufclark9390
    @yussufclark9390 Před 2 lety

    More ngxs

  • @JackStepanyan
    @JackStepanyan Před 6 lety

    Thanks for great video however for me who knows NGRX this looks more complicated.

    • @Fireship
      @Fireship  Před 6 lety +1

      Both libraries are excellent. If you already use NgRx and enjoy the dev experience, then I would stick with that.

    • @wangzhou176
      @wangzhou176 Před 6 lety

      agree, feel complicated after being familiar with ngrx. Will give it a try anyway :)

  • @aNotoriousPhD
    @aNotoriousPhD Před 5 lety +3

    this video went by way too fast imo. is there an article where I could follow this at my own pace?

    • @Keschoo
      @Keschoo Před 4 lety

      Use video speed playback modifier

  • @pedambr199
    @pedambr199 Před 5 lety

    im late to the party, thanks for the video

  • @hansschenker
    @hansschenker Před 6 lety

    It is too early to introduce yet another libray for the Angular State Management. The people should learn NgRx the "offficial" Angular State Management Library. Later the fan of Decorators can switch to NGXS.
    NGXS has some nice parts but it is even a step further to make to learn the library.
    NgRx has more boilerplate, but it is easier to mentally follow it because it has less hidden ("magic"??) parts!

    • @Fireship
      @Fireship  Před 6 lety

      That's a fair argument, but I would say NGXS is easier to learn if brand new state management. I'm not advocating one or the other, but was especially impressed with this library, hence the video.

    • @amcdaniel22
      @amcdaniel22 Před 6 lety +2

      There is no official state management library for Angular.

    • @hansschenker
      @hansschenker Před 6 lety

      I think it would be fair to support the NgRx People for their initial work on Angular State Management.

  • @love.ly.
    @love.ly. Před 4 lety

    I read "Anger State Management" for some reason lol

  • @defenseman84
    @defenseman84 Před rokem

    Tell me something, what’s so wrong my with holding on to state in angular services in simple variables. Then have your components simply bind to that data. Whenever data changes (pulling, listening, web sockets, … etc), simply update your state variables in your services. Why have all this “management”?!

  • @GlennMartin
    @GlennMartin Před 3 lety +1

    Is this still legit in 2021?

    • @zGollum
      @zGollum Před 2 lety +1

      same question... there's been a lot of progress in ngrx to reduce the boilerplate needed, so this video is kind of out of date now, although it's still pretty cool!

  • @dule605
    @dule605 Před 3 lety

    I work with angular 4 years every day, i still dont understand the point or benefit of this

    • @tomfrank2115
      @tomfrank2115 Před 3 lety

      neither do I but a lot of jobs require it.. I start next week prob. a job with ngxs.. so I have to learn it.. been using regular angular for the last 2 years just fine.

  • @abiudrn8802
    @abiudrn8802 Před 5 lety +1

    I really don't like it when you copy paste code. Its better to have 1 1hr video than an 11min video that most users won't understand. Assume a beginner's mindset. Just saying :)