Typescript for React and MobX From Beginners to Masters

Поделиться
HTML-код
  • Опубликовано: 2 мар 2021
  • Continuing on with Typescript we are starting a series on React state management where we take the same To-Do list and implement it using a bunch of different state managers. This time we are looking at MobX!
    MobX: mobx.js.org/
    Starting code: github.com/jherr/todo-base
    Finished code: github.com/jherr/todos-many-w...
    If you liked this video, buy me a coffee! www.buymeacoffee.com/bluecoll...
    Hope you folks enjoy this!
    👉 If you enjoy this video, please like it and share it.
    👉 Don't forget to subscribe to this channel for more updates: bit.ly/2E7drfJ
    👉 Weekly free newsletter: www.jackherrington.com/subscr...
    👉 Discord server signup: / discord
    💢 Watch our other videos:
    💟 Hacking your Github contribution graph: • Hacking Your Github Co...
    💟 Build a KK Slider Slider: • Build A K K Slider Sli...
    Thank you for watching this video, click the "SUBSCRIBE" button to stay connected with this channel.
    Subscription Link: bit.ly/2E7drfJ
    #reactjs #typescript #mobx
  • НаукаНаука

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

  • @CodingNuggets
    @CodingNuggets 3 года назад +15

    I haven't looked into MobX because I haven't had a need for it and haven't had any request for it in projects. Still good to know, so thanks for giving me a quick look.

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

      Hey hey! Thanks for the pin Jack. I was just giving you accolades in Jesse's (codeSTACKr's Discord) for the weekly news inclusion. Love your content and watching you grow. Growing with you my friend. 🙂

  • @user-vw9qj8el4q
    @user-vw9qj8el4q 2 года назад +8

    You deserve bigger audience with such a content! Thank you a lot for great introduction to MobX!

  • @craigjohnson8279
    @craigjohnson8279 3 года назад +6

    This is awesome, thanks Jack. I love that you did some Fetch requests as well! :)

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

    Very well explained, thank you! I like the way you go straight to the point and the use of pure functions. You have +1 subscriber.

  • @ngochunglongnguyen4523
    @ngochunglongnguyen4523 3 месяца назад

    OMG you're a great teacher. You helpt me learn MobX in under 15mins while Redux and Redux toolkits took me at least 2 days to go through all the practical implementation. That is really productive.

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

    Thankssss Jack, your videos are really helpful! I hope you continue to make more!

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

    big thank you for the video. i can now efficiently use it in my projects

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

    This is such a quality tutorial, great job!

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

    Just what I needed! Thanks!

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

    Hi Jack, thanks for your videos, they are much helpful and superb! Hope you will continue to make so useful stuff

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

    i was struggling with mobx to handle a small app as I am more inclined towards doing all with redux! but had to had it in this small all! so MOBX and your tuts helped! thanks

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

    I was a little bit scaried about using Mobx but you explained so easy that I want to implement it. Thanks

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

      Nothing to be scared about, MobX is good stuff.

  • @BlackSlimShady
    @BlackSlimShady 4 месяца назад +1

    Amazing content, thank you!

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

    This is top notch high quality channel

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

    Thank you! I've spent a long time on this. Easy as soon as it works :-)

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

      Aint that always the way? 😀

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

    That SATURN V is gorgeous!

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

    thank you so much for great video. i could understand so easily 👍

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

    Great video!

  • @user-be7jw6nl1p
    @user-be7jw6nl1p 2 года назад +1

    thx Jack , i'm working React developer , and i 'm beginner in TS and MobX, offcourse your code's strange for me, but i repeated my-self and it's greate. Good Luck and be healthy !

  • @DOMAN89
    @DOMAN89 3 года назад +4

    Hi Jack I have some suggestion:
    1. In your case you can omit the returning type of functions like in addTodo, because TypeScript is able to infer the type.
    2. Maybe would be nice to show that, we can create for example:
    type AddTodo = (todos: Todo[], text: string) => Todo[];
    and use it in this way:
    const addTodo: AddTodo = (todos, text) => [ ....
    But of course very nice video and thumb up :)

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

    Thanks a lot for the video

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

    Great video Jack, as per usual!
    Could we get access to that performance test you mention in the video? Thanks!

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

    This is cool

  • @lactobacillo79
    @lactobacillo79 3 года назад +8

    Hi Jack, thank you so much for your videos. I love MobX too and MST, but in this example your are modifying directly some observables, meanwhile in the MobX documentation it's highly adviced to modify the observables properties using an action, what's your opinion about that?
    Regards...

    • @jherr
      @jherr  3 года назад +6

      In larger applications you definitely should use actions to mutate the state instead of directly mutating it.

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

    Very helpful video!
    What are you using to change the way arrows and inequalities in your code are displayed?... I assume it's some VSCode plugin

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

      Enable ligatures with the a font that supports ligatures.

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

    Hey Jack, thanks for all your videos! What is your personal favorite when it comes to state management in a rather large project? The amount of state management tools is crazy and makes it difficult to choose the right one for your needs since they are all pretty similar but still offer different nifty solutions. Would you say at the end of the day it is personal preference and what would you personally recommend?
    PS: My current go-to solution is using React's Context API with actions and reducers so it looks pretty similar to the Redux boilerplate code but doesn’t really bloat the project since it is a built-in solution. Works great on smaller projects but the amount of rerenderings would probably slow down the application as it grows so I'm looking for an alternative for bigger projects. And since most of the backends I currently build and interact with are Apollo/GraphQL/Lambda based, using Apollo Client as a state manager (with its cache) would also be a good solution for bigger projects no?
    Thanks in advance 🙌

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

      I personally haven't tried using just Apollo for state management. I realize that there is an overlap there between Apollo and global state management, but I always found I needed some number of globals (e.g. user ID, auth state, etc.)
      I'd probably go with Zustand for large projects. It's very lightweight. It has solid Typescript support. And you can't just directly set values on the store, which is great for small projects but a little less awesome in larger team projects.

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

      @@jherr Awesome, this was exactly what I was thinking about as well. Thank you for answering! Looking forward to your upcoming videos and happy coding :)

  • @AwadheshKumar-rk2mu
    @AwadheshKumar-rk2mu Год назад

    Hi Jack,
    Can you please make detail video on mobx.

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

    Hi Jack, great videos! Heads up, it looks like your Discord server invite link is invalid.

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

      Yep. Looks like it times out? I need to write a script to update all the video descriptions. 😂

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

    Been using Mobx lately and loving it. Any clues on persisting data without the use of decorator?

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

      No, but as I recall they always have decorator-less alternative. So if you can't find it in the docs I'm sure you can ask in a support channel.

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

      @@jherr Thanks Jack. Awesome contents, btw. Cheers.

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

    For things like newTodo should use local state like useState rather than store, even in mobX.

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

    I prefer using MobX store actions as it enforces cleaner flow.

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

      And what I mean by that - if for example you have multiple consumers of the same store and variables actions allow for easier debugging to see where did the change for the store came from.

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

      I should have added a section on actions, they are definitely a good way to ensure the integrity of the store.

  • @ram-bk4mu
    @ram-bk4mu 2 года назад +1

    Could you please make videos on design patterns with examples? :)

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

      Yep, that's what I've been doing a lot of lately: ruclips.net/video/SZ2kAkMdAZE/видео.html

    • @ram-bk4mu
      @ram-bk4mu 2 года назад

      @@jherr Oh great!!! thanks! also videos on Algorithms can be very helpful, I would pay for your courses Sir! I will at least get all my friends subbed to you channel! Cheers

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

    💙🙏

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

    what playlist is this video belong to?

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

    Are there any videos for testing react components with MobX -- you alluded in the video that it would be more difficult because you need to wrap the components, but unsure how to approach that. @JackHerrington

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

    What is that funky theme you like so much?? :)

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

      Apollo Midnight with some tweaks to make it Italic.

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

      @@jherr Thanks, and just so you know--the vids on TS/React => very helpful as a distillation of the cheatsheets and more.

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

      @@adicide9070 Thanks!

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

    MobX seems pretty straightforward, but i think zustand simplify my life.

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

    Agree Mobx is a terrible name of a observer library. I guess the "ob" is for observer but still

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

    Hi! I'm trying to learn MobX. With it, why would need React's context hook when I can just import my MobX container freely throughout the app?

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

      I don't think you need to use context if you are using MobX.

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

      @@jherr Thanks Jack!

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

    20201 and class?

  • @nathantorquato9777
    @nathantorquato9777 3 года назад +6

    nah.. just too easy, don't like it ahhahahaha
    question though: what about rendering performance? does it cause unnecessary re-rendering?

    • @DavidSmith-ef4eh
      @DavidSmith-ef4eh 3 года назад

      nope... only re-renders if the mobx properties used in the components change.

  • @user-be7jw6nl1p
    @user-be7jw6nl1p 2 года назад +1

    Why do you throw MobX class methods outward ?

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

      I'm not sure what that means. Could you clarify that a little?

    • @user-be7jw6nl1p
      @user-be7jw6nl1p 2 года назад

      @@jherr when you realised TodoStore you code functions with enter values, why you didn't use class methods ?

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

      @@user-be7jw6nl1p Can you point to a particular time in the video where I do this?

    • @user-be7jw6nl1p
      @user-be7jw6nl1p 2 года назад +1

      Why independent functions instead class Methods ?

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

      @@user-be7jw6nl1p Oh, I see, no particular reason. Feel free to drop to those in the class. Honestly, this video is part of a series of videos I've done across a variety of state managers. So if you are familiar with that series I use those same functions across all of them, and so it would let folks know that the implementation of addTodo isn't changing between any of them. They all do addTodo and removeTodo the same way. But you are correct, the "correct" implementation here would be to put that logic into the class.

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

    I liked better Zustand =)