What State Management Library Should I Use with React?

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

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

  • @alvechy
    @alvechy 3 года назад +7

    Jumping straight to XState makes one David somewhere in the world smiling

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

    My team and I just got a new project, and our team lead wanted us to make POC for different state management libraries. This video was extremely timely!

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

    Sent this video to a dozen devs. Great great explanation that I will be referencing for a long time.

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

    now that is called awesome! thanks for the great tutorial and a taste of history.

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

    Using zustand and immer with typescript. Never enjoyed doing state management so much before.

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

    Hey this video is really useful for our community, thanks!

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

      Thank you! Glad you found it useful.

  • @pieter-venter
    @pieter-venter 3 года назад

    Thanks Lee for always having high quality videos with all the dense info in a very short time. I know it's not easy to edit a video like that and you probably need to repeat shooting parts multiple times. No "umm..." or "okay, let's wait for that to install"

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

    Thank you for creating this video. It really helped me to understand react and state. I didn't know about the types of states in an app. For the past couple of weeks, i have been working on a project which requires fetching a lot of data in my next app. basically I wanted to create a dashboard. I wanted to reduce unnecessary API calls. Today I got to know about SWR. I knew about react query but never knew what it does. This video literally summed up everything. I am watching your videos for the past couple of days they are really helpful

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

      I really appreciate this comment. Glad I could help!

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

    Great video!

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

    Every project don't need heavy libraries like Redux/Recoil. Sometimes you just needs to create and consume global states. "react-rhino" is a library which does exactly the same with simple and straight forward syntax.
    It uses Context API under the hood, but is very very simple than useContext.

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

    use react query to manage your server state. redux and other libraries are not ideal to manage server state lifecycles. react query handles caching, fetching, and updates asynchronous data. if you remove all the server state from redux or other libraries to react query, your global state becomes very thin.

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

    This is the best video I've seen on this topic. Thank you so much for all of the great info here.

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

    great explanation.

  • @Daniel-ve8yr
    @Daniel-ve8yr 3 года назад +1

    would you only use a caching library like SWR if you don't expect the API results to change in the short term? for example, if you're fetching stock quotes, i would imagine you don't want to used the cached result from 2 minutes ago.

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

    Excellent👍

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

    Who can dislike this. Cheers buddy

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

    thumbs up for Schiit Stack behind

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

    Such a great content but would like to see you create in depth videos for differnet state management lib or even intro to the upcoming useSelectedContext!

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

    lol I said "it depends" in the same time haha, great video Lee thanks!

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

    Always great content
    Thank you for all

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

    Wow. This was great.

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

    Thanks Lee! What state management solution can be used for keeping global state of websocket data coming from IOT sensors to dashboard?

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

    Great vid!

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

    What do you think about recoilJs?

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

      4:45 😁No strong opinion other than it works well for certain use cases.

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

    Your thoughts on zustand? Great vid Lee

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

      Thank you! The Zustand authors seem to be recommending Valtio now: twitter.com/dai_shi/status/1358568517100920832

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

      @@leerob didn’t know about Valtio. I was using zustand + immer for one of my projects. I also found recoiljs very similar to zustand

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

    For small projects Redux is not needed, but as a project grows it may become necessary. The Context API is great for side and small projects, but may not be enough. I use Redux mainly, but I'm starting to use react-query for my fun/side projects. Appreciate your input Lee. See you soon!

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

    Can I ask whats your react stack? Like what library do you use/like?

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

    fantastic video. also appreciate the excellent bookmarking 👍

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

    Hi, I am using pullstate which is very very easy while comparing all other global state management for react of redux, recoil, jotai etc. Is it good to use pullstate? Since I am a beginner i am finding difficult to choose the global state management.

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

    Client state: Hookstate
    Server state: React Query
    I've reduced a ton of boilerplate-y code with those
    Have fun

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

    Wow. I’m going to have to try swr 😳

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

    What's so bad about prop drilling? Verbose yes, but clear and easy to understand, also yes!

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

      Makes it painful to maintain / re-write code.

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

      Go make something bigger than todo list and you`ll find out

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

    thanks for such a video

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

    Great video as always! For form state management you didn't mention react-hook-form any thoughts on this?

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

      I've made a video using it before, it's nice! Formik is just the most popular and widely used.

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

      Didn't see it ... yet ;)
      Understand that you talk about the most popular one. It just seems to me that R-H-F is much easier to use and less boilerplate than formik. Anyway thanks for your answer and for the great content

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

    hello, did you try zustland? would like to here your thoughts, i think it is the simplist one so far.

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

    React Context for context and xstate for state! context is the values you need through a component, state is a state!

  • @ГенаПетров-н5ы
    @ГенаПетров-н5ы 3 года назад

    What library best for figma like app?

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

    React-query.

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

      Redux adds a lot of unnecessary complexity and setup. Even in large projects, most of the time you don't need redux. Also, many times a lot of state don't need to be at the global scope and with redux people tend to put everything as global state. Unless redux middlewares like sagas are needed and are properly used, redux is unnecessary.

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

      @@shahzadaalihassan_vlogs Yes

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

      @Jack Saat This is true, but Redux is overkill for many projects.

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

    I'll write this while i'm still watching the video, so i'll comeback later if the answer is in the video
    How SWR data that was fetched from an API is available to all my components as a global state? or it is that it doesn't make a fetch to an specific route if it was called previously by another component 🤔

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

      SWR provides the caching layer for you. So if you make a request to /api/user, you can use the useSWR() hook in 100 places across your codebase calling that same endpoint, and they're all looking to the same place in the cache!

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

      @@leerob Amazing even without internet connection?

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

      @@abumubarak_dev yes

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

    I think only components that have useContext and their children rerender, not every component under the context provider.

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

    react-query

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

    I was frustrated by redux🥴. I ended up creating my own state management library 🥴🥴

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

    Zustand

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

    just use angular it doesnt suck

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

    I was trying to learn how to luse redux with redux tk, but then the docs mentioned the use of IMMER. It was a totally turn off for me.

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

    the answer is, all of them, I usually combine context/swr/hooks. Going forward I can see redux become less popular.

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

    I prefer zustand

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

    Zuuuuuuuustanddddddddd

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

    just don't use redux and you will probably be okay (or better than with redux)

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

    You should use redux, sorry guys

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

      I think the central store is a big advantage, I have been trying context and use useReducer which is fine for small projects but doesnt feel right as things start to grow.

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

      @@lardosian same here

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

      but it's so hard

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

      @@ufufu001 I agree

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

      @@ufufu001 Check out redux-toolkit. Much easier and cleaner code.

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

    none.. more bloat more complexity

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

      @Jack Saat Throwing other problems at a problem is not the solution