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
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
Thanks for explaining the 'Why' part
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
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.
Plain , simple and easy-to-grasp...TYSM
Great video, i use immer in each reducer of redux, to prevent mutation
oh this is so cool! The code looks so much neater with immerJS
Excellent explanation, thank you for your hard work
Thanks for explaining this new concept to us
Watched this till the end. Immer seems cool.
This is actually awesome.
Thanks for this Video!
Amazing tutorial.
I watched this video till the end ✌🏻
We can create another object by Object.create(obj)..the new object will point to the prototypes properties..we can override those properties
DEEP
INSIDE
MY HEART
I WATCHED THIS VIDEO TILL THE END!
I watched the videos till the end.
4th comment
And thanks for this amazing crash course
Thank you
nicely explained
I watched this video till the end.
Hello, What how did you get the Browser Logs tab in the terminal is it an extension?
we can use constructor functions right?
Wouldn’t be easier if we destructure whole “obj” then change property using chaining???
nope
javascript can clone upto 1 level only ... 2 level onward it has same reference
@@pairohit305 ohh. I didn’t know that. Thanks🙌🏼
how do we can able to access anotherAnotherObj directly at line no 15
draft object isn't returned from produce callback. Is the object returned automatically @codedamn?
🔥🔥🔥
Redux toolkit use this immer library behind the scene
nice vid
Why cant Object.assign work
is this alternative wrong?
const myFunc = (obj, callback) => {
const _ob = {...obj}
callback(_ob)
}
const obj3 = myFunc(obj, draft => {
draft.hello = "hello"
})
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
Immer vs Jotai? Which would you choose, or are they totally different tools?
Jotai is a state management tool. It has nothing to do with this, but you can use both together.
@@liu-river Please can you explain the difference between Jotai and Immer?
@@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.
@@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.
@@taylorreeves3642 I hope you found other solutions for your project. There always the next one :D
One more level of abstraction over babel 😂 I think Next version of exam script should make these features as innate.
Hey
Hi, the playground is not accesible (Access Denied, You don't have permissions to access this page).
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 😅
Redux toolkit already uses Immer under the hood
Please don't use this video aspect ratio.
I watched this video till the end ✌🏻