Immer.js Crash Course - And Why Immutability Is Very Important ⚡

Поділитися
Вставка
  • Опубліковано 31 лип 2024
  • Immer.js is a library for working with immutable data, it allows JavaScript developers to use immutable state while keeping the simplicity and convenience of manipulating mutable states. This means that developers can mutate data as usual while keeping all the benefits of immutable data. In this video, let's take a deeper look at Immer.js, about what is immutability and why is it important?
    ⚡ Try out Immer.js here:
    codedamn.com/playground/lHV3L...
    Drop a comment and let us know if you've watched this video till the end!
    ⚛️ Do you want to become a full-stack web developer? Check out codedamn's full-stack learning path: cdm.sh/fullstack
    ⚛️ Get started with web3 and decentralized technologies today: cdm.sh/web3
    Timestamps
    0:00 Teaser
    0:39 Example of Immer JS
    4:12 immer.produce() function
    8:29 Conclusion
    9:39 Outro
    👉 Checkout codedamn on social:
    Instagram: cdm.sh/ig
    Twitter: cdm.sh/twt
    Discord community: cdm.sh/discord
    Facebook: cdm.sh/fb
    GitHub: cdm.sh/github
    If you found the video valuable, please leave a like and subscribe ❤️ It helps the channel grow and helps me pump out more such content.
    ✨ Video Tags ✨
    All About Immer.js | What is Immutability And Why Is It Important?
    Learn Immer.js With Example | Learn Immer.js Under 10 Mins
    ✨ Hashtags ✨
    #Immer.js #JavaScript #Immutability #2022

КОМЕНТАРІ • 49

  • @codedamn
    @codedamn  2 роки тому +2

    Immer.js is a library for working with immutable data, it allows JavaScript developers to use immutable state while keeping the simplicity and convenience of manipulating mutable states. This means that developers can mutate data as usual while keeping all the benefits of immutable data. In this video, let's take a deeper look at Immer.js, about what is immutability and why is it important?
    ⚡ Try out Immer.js here:
    codedamn.com/playground/lHV3L18PVn3uR_MWfpApT
    Drop a comment and let us know if you've watched this video till the end!
    ⚛️ Check out codedamn's full-stack learning path: cdm.sh/fullstack
    ⚛️ Get started with web3 and decentralized technologies today: cdm.sh/web3

  • @abhishekchandel4244
    @abhishekchandel4244 2 роки тому +8

    Thanks for explaining the 'Why' part

  • @_its_omg
    @_its_omg 2 роки тому

    at start I loved yt filled with a lot of content now after about 2.5 yrs of development I have out grown yt not many channels with big 5Head requirement stuff available have to read though docs [ yes enjoyable : ) ].... and here comes codedamn giving some important dev stuff needed thanks dude will deffinelty use this ... keep making content like these

  • @TinyMaths
    @TinyMaths 11 місяців тому

    Thanks Bro. I started on React a bout 6 weeks ago and am building an inventory app. I avoided immer so far but I have deeply nested objects so it's a lot of work to get to an item. So today I decided that I might as well use immer, especially since you mention that the code is hard to read if you do it manually; my code is definitely wordy and even I struggle a bit to read what's going on if I'm debugging. Thanks for the tutorial.

  • @samareshshil69
    @samareshshil69 7 місяців тому

    Plain , simple and easy-to-grasp...TYSM

  • @aliarslanansari
    @aliarslanansari 2 роки тому +1

    Great video, i use immer in each reducer of redux, to prevent mutation

  • @theatypicaldeveloper
    @theatypicaldeveloper 2 роки тому

    oh this is so cool! The code looks so much neater with immerJS

  • @gopalbhattarai9707
    @gopalbhattarai9707 Рік тому

    Excellent explanation, thank you for your hard work

  • @nimitsavant3127
    @nimitsavant3127 2 роки тому

    Thanks for explaining this new concept to us

  • @lakbychance
    @lakbychance 2 роки тому

    Watched this till the end. Immer seems cool.

  • @null_spacex
    @null_spacex 2 роки тому

    This is actually awesome.

  • @SUlutas
    @SUlutas 9 місяців тому

    Thanks for this Video!

  • @Dipenparmar12
    @Dipenparmar12 Рік тому

    Amazing tutorial.

  • @moatazmohammady6668
    @moatazmohammady6668 Рік тому

    I watched this video till the end ✌🏻

  • @ngxgray
    @ngxgray 2 роки тому

    We can create another object by Object.create(obj)..the new object will point to the prototypes properties..we can override those properties

  • @tedchirvasiu
    @tedchirvasiu Рік тому

    DEEP
    INSIDE
    MY HEART

  • @khizrshaikh9902
    @khizrshaikh9902 2 роки тому

    I WATCHED THIS VIDEO TILL THE END!

  • @somnathgolui2912
    @somnathgolui2912 2 роки тому

    I watched the videos till the end.

  • @khizrshaikh9902
    @khizrshaikh9902 2 роки тому

    4th comment
    And thanks for this amazing crash course

  • @yadneshkhode3091
    @yadneshkhode3091 2 роки тому

    Thank you

  • @sportsvogue8188
    @sportsvogue8188 2 роки тому

    nicely explained

  • @vaibhavyadav8726
    @vaibhavyadav8726 2 роки тому

    I watched this video till the end.

  • @afro_habesha
    @afro_habesha 4 дні тому

    Hello, What how did you get the Browser Logs tab in the terminal is it an extension?

  • @souravdas423
    @souravdas423 2 роки тому

    we can use constructor functions right?

  • @s-h-f
    @s-h-f 2 роки тому +4

    Wouldn’t be easier if we destructure whole “obj” then change property using chaining???

    • @pairohit305
      @pairohit305 2 роки тому +3

      nope
      javascript can clone upto 1 level only ... 2 level onward it has same reference

    • @s-h-f
      @s-h-f 2 роки тому

      @@pairohit305 ohh. I didn’t know that. Thanks🙌🏼

  • @DeepakPatel-hc5eo
    @DeepakPatel-hc5eo Рік тому

    how do we can able to access anotherAnotherObj directly at line no 15

  • @rahuls331
    @rahuls331 Рік тому

    draft object isn't returned from produce callback. Is the object returned automatically @codedamn?

  • @manoj-k
    @manoj-k 2 роки тому

    🔥🔥🔥

  • @iganic7574
    @iganic7574 8 місяців тому

    Redux toolkit use this immer library behind the scene

  • @user-jy5lz3qc5r
    @user-jy5lz3qc5r 4 місяці тому

    nice vid

  • @LakshmikanthAyyadevara
    @LakshmikanthAyyadevara 2 роки тому

    Why cant Object.assign work

  • @0xPanda1
    @0xPanda1 2 роки тому +1

    is this alternative wrong?
    const myFunc = (obj, callback) => {
    const _ob = {...obj}
    callback(_ob)
    }
    const obj3 = myFunc(obj, draft => {
    draft.hello = "hello"
    })

    • @codedamn
      @codedamn  2 роки тому +3

      Yes, because it would mutate the following:
      const obj = { a: { b: 2 } }
      const obj2 = myFunc(obj, draft => {
      draft.a.b = 100
      })
      now obj.a.b is also 100. Spread operator does not clone deeply

  • @taylorreeves3642
    @taylorreeves3642 2 роки тому

    Immer vs Jotai? Which would you choose, or are they totally different tools?

    • @liu-river
      @liu-river Рік тому

      Jotai is a state management tool. It has nothing to do with this, but you can use both together.

    • @taylorreeves3642
      @taylorreeves3642 Рік тому

      @@liu-river Please can you explain the difference between Jotai and Immer?

    • @liu-river
      @liu-river Рік тому +1

      @@taylorreeves3642 Jotai is a state management system like Redux and react Context API, it's like setting your states on a global level and then use it in any component you want, without having to pass that state as prop down to each components. While Immer helps you create new objects much faster, instead of writing spread syntax, you write as if you would to change the original object, this video explains it, watch it again.

    • @taylorreeves3642
      @taylorreeves3642 Рік тому

      @@liu-river Thankks for the clarification. Unfortunately had you commented 5 months ago I would've used it on this project I've been working on over the last 6 months.

    • @liu-river
      @liu-river Рік тому

      @@taylorreeves3642 I hope you found other solutions for your project. There always the next one :D

  • @Sandeep-zd6dq
    @Sandeep-zd6dq 2 роки тому

    One more level of abstraction over babel 😂 I think Next version of exam script should make these features as innate.

  • @user-cq4zk8mw6r
    @user-cq4zk8mw6r 3 місяці тому

    Hey

  • @jdiazco
    @jdiazco Рік тому

    Hi, the playground is not accesible (Access Denied, You don't have permissions to access this page).

  • @madhuprasad4822
    @madhuprasad4822 2 роки тому +1

    Funfact : Author of immer is the author of mobx
    Mobx does not support immutability like redux , i guess mobx+immer combo will be 🔥
    Also i watched the video till end 😅

    • @ritzbhmb1742
      @ritzbhmb1742 2 роки тому

      Redux toolkit already uses Immer under the hood

  • @bhavyajain638
    @bhavyajain638 2 роки тому +1

    Please don't use this video aspect ratio.

  • @akshaybhargava5437
    @akshaybhargava5437 2 роки тому

    I watched this video till the end ✌🏻