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

แชร์
ฝัง
  • เผยแพร่เมื่อ 18 พ.ย. 2024

ความคิดเห็น • 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

  • @samareshshil69
    @samareshshil69 10 หลายเดือนก่อน

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

  • @TinyMaths
    @TinyMaths ปีที่แล้ว

    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.

  • @_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

  • @aliarslanansari
    @aliarslanansari 2 ปีที่แล้ว +1

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

  • @lakbychance
    @lakbychance 2 ปีที่แล้ว

    Watched this till the end. Immer seems cool.

  • @theatypicaldeveloper
    @theatypicaldeveloper 2 ปีที่แล้ว

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

  • @tedchirvasiu
    @tedchirvasiu 2 ปีที่แล้ว

    DEEP
    INSIDE
    MY HEART

  • @null_spacex
    @null_spacex 2 ปีที่แล้ว

    This is actually awesome.

  • @gray_dragneel
    @gray_dragneel 2 ปีที่แล้ว

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

  • @gopalbhattarai9707
    @gopalbhattarai9707 ปีที่แล้ว

    Excellent explanation, thank you for your hard work

  • @SUlutas
    @SUlutas ปีที่แล้ว

    Thanks for this Video!

  • @khizrshaikh9902
    @khizrshaikh9902 2 ปีที่แล้ว

    I WATCHED THIS VIDEO TILL THE END!

  • @rahuls331
    @rahuls331 ปีที่แล้ว

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

  • @akshaybhargava5437
    @akshaybhargava5437 2 ปีที่แล้ว

    I watched this video till the end ✌🏻

  • @afro_habesha
    @afro_habesha 3 หลายเดือนก่อน

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

  • @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🙌🏼

  • @vaibhavyadav8726
    @vaibhavyadav8726 2 ปีที่แล้ว

    I watched this video till the end.

  • @somnathgolui2912
    @somnathgolui2912 2 ปีที่แล้ว

    I watched the videos till the end.

  • @nimitsavant3127
    @nimitsavant3127 2 ปีที่แล้ว

    Thanks for explaining this new concept to us

  • @DeepakPatel-hc5eo
    @DeepakPatel-hc5eo ปีที่แล้ว

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

  • @manoj-k
    @manoj-k 2 ปีที่แล้ว

    🔥🔥🔥

  • @Dipenparmar12
    @Dipenparmar12 2 ปีที่แล้ว

    Amazing tutorial.

  • @khizrshaikh9902
    @khizrshaikh9902 2 ปีที่แล้ว

    4th comment
    And thanks for this amazing crash course

  • @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

  • @sportsvogue8188
    @sportsvogue8188 2 ปีที่แล้ว

    nicely explained

  • @iganic7574
    @iganic7574 ปีที่แล้ว

    Redux toolkit use this immer library behind the scene

  • @souravdas423
    @souravdas423 2 ปีที่แล้ว

    we can use constructor functions right?

  • @HyperionX-w5d
    @HyperionX-w5d 7 หลายเดือนก่อน

    nice vid

  • @yadneshkhode3091
    @yadneshkhode3091 2 ปีที่แล้ว

    Thank you

  • @LakshmikanthAyyadevara
    @LakshmikanthAyyadevara 2 ปีที่แล้ว

    Why cant Object.assign work

  • @taylorreeves3642
    @taylorreeves3642 2 ปีที่แล้ว

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

    • @liu-river
      @liu-river 2 ปีที่แล้ว

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

    • @taylorreeves3642
      @taylorreeves3642 2 ปีที่แล้ว

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

    • @liu-river
      @liu-river 2 ปีที่แล้ว +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 2 ปีที่แล้ว

      @@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 2 ปีที่แล้ว

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

  • @jdiazco
    @jdiazco 2 ปีที่แล้ว

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

  • @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.

  • @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.

  • @HousseinAlDroubi
    @HousseinAlDroubi 7 หลายเดือนก่อน

    Hey

  • @moatazmohammady6668
    @moatazmohammady6668 ปีที่แล้ว

    I watched this video till the end ✌🏻