Комментарии:
Helpful
ОтветитьThx
ОтветитьThank you
ОтветитьI wonder why the name "unshift" was chosen by spec designers? Would've been really easier if they had given it some easier name.
ОтветитьThanks! This is so useful. I encountered this at work and you save me.
ОтветитьA nice Game Changer.
Ответитьredux is way too much boiler plate. whoever created it was on crack
ОтветитьThis might be outdated, but I'm using Immer for the first time and mutating the draft object NEVER causes a re-render for any of my functional components. I'm using useSelector. Why is this?
ОтветитьWhat extension are you using to show the size of imported packages?
Ответитьty for sharing
ОтветитьI have one question, redux has one hook called useSelector, so if i use that, can i stop using reselect, are both doing same ? do useSelector give the same performance ?
ОтветитьThis is what I was looking for, I had already done making my userReducer a lot mess. This will certainly make my reducer cleaner.
ОтветитьRandom question, but is there any reason why you can't make a copy of todos yourself and modify the copy then return the copy instead of pulling in a library for that? That way you can do what you want and you aren't modifying the state. For example:
const todosReducer = (todos, action) => {
const state = todos.slice();
switch (action.type) {
case "ADD_TODO":
state.unshift({ text: action.text, complete: false });
return state;
case "TOGGLE_COMPLETE":
state[action.i].complete = !state[action.i].complete;
return state;
case "RESET":
return [];
default:
return todos;
}
};
Cheers for the vids, enjoying them (learning react atm)
Funny how no one noticed that you have bug handling RESET case with immer :)
ОтветитьGreat video! Thanks! Will you do more about immer then?
ОтветитьImmer hooks are awesome!
Ответитьso glad you ended up trying it out Ben! love it!
ОтветитьBravo.
ОтветитьHey Ben, immer is a good library, but need to mention that it doesn't work in IE11 and there is no way to polyfill it since it's based on JS Proxy.
ОтветитьWhy not just clone the todos with lodash.cloneDeep function?
ОтветитьWhy not use Immutable? I use it in production all the time. Makes it much easier!
ОтветитьThis is exciting, thanks
ОтветитьHi. Does immer say something about calculation speed? Immutable also was good approach ...
Ответитьvery clean approch
ОтветитьGreat video thanks👌
ОтветитьHey Ben, this is super useful. Will definitely try it in my next project. Thank you so much for publishing such latest videos. Your hardwork is much appreciated. :)😊
Ответить