Why Redux Store Changes Don't Re-render

Поделиться
HTML-код
  • Опубликовано: 8 сен 2024
  • When using Redux, it's common to run into issues where your store isn't updating, or isn't updating in the way you expect it to. In this edition of Bugfixes, we're tackling the most common reasons why Redux store changes don't re-render. Cheers!
    --
    Follow Me Online Here:
    🌏 My website/blog - peterelbaum.com
    ✉️ My newsletter (weekly on Sundays) - peterelbaum.co...
    🤓 My courses: peterelbaum.gu...
    🗣 One-on-one mentoring - superpeer.com/...
    🐦 Twitter: / peterelbaum
    💻 GitHub: github.com/elb...
    ☎️ Office Hours: calendly.com/e...
    --
    My gear:
    Main Camera: amzn.to/2Tv1WBe
    Tripod: amzn.to/2t570AH
    External HD: amzn.to/2t1UphI
    Memory card: amzn.to/2UEQfIn
    Computer mic: amzn.to/2t7mUue
    --
    Who am I?
    I'm Peter Elbaum, a software engineer living in Raleigh, North Carolina. I make videos about code, software engineering career development, and self improvement. I also have a newsletter (peterelbaum.co...) and tweet my thoughts on money, work, and being a great dev. Feel free to get in touch!

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

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

    As far as I understand it, component re-rendering will happen ONLY if either the props or the state OF THE COMPONENT change.
    Changes in Redux state will not re-render the component by default even if you ensure you are changing Redux by making copies of objects in the store instead modifying the exiting objects.
    That is why "connect" and "mapStateToProps" exist in Redux and the react-redux library, so that changes in the Redux state will modify a component's props and this will cause re-render.
    If that's not the case, please let me know, as I am still working to fully grasp it!

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

      That is also my understanding. You have to connect either with connect or useSelector so the local state of a component is dependent on the redux store

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

    Thanks for sharing Peter. Another good video I’m loving the short and sweet format. Cheers

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

      Glad you enjoyed it - thanks Bryan! :)

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

    you should show some codes

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

    I am using the spread operator and the issue is still persisting

    • @pankaj_9998
      @pankaj_9998 7 месяцев назад

      yes for me as well

    • @pankaj_9998
      @pankaj_9998 7 месяцев назад

      did you find solution?

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

    Thank you sir I am very grateful for this video

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

    Thanks this helped me debug

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

    This is no longer relevant with redux toolkit