ReactJS / Redux Tutorial - #4 Working with State and Immutability

  Рет қаралды 109,928

Academind

Academind

Күн бұрын

Пікірлер: 89
@inventanew
@inventanew 8 жыл бұрын
this is a great series, I was watching the egghead tutorials, but yours is much more down to earth and less assumptions that you know what your doing already. Thank you so much.
@academind
@academind 8 жыл бұрын
Really amazing to hear that John, thanks so much for your great feedback! :)
@ltrinhmuseum
@ltrinhmuseum 6 жыл бұрын
Maximilian is such a great teacher. It is hard to appreciate the work he puts into his tutorials, but if you have tried to learn this on your own or with a second-tier teacher you'll clearly see how great Maximilian is!
@academind
@academind 6 жыл бұрын
I cannot thank you enough for sharing such a fantastic feedback. Reading this honestly makes me happy :)
@juliepanko
@juliepanko 5 жыл бұрын
@@academind You are truly great teacher, your manner of explanation is very clear and understandable! Thank you!
@jean-baptistelasselle4562
@jean-baptistelasselle4562 Жыл бұрын
your videos are very well done, sticks to only what is technical core, with a logic and clear explanations. Nice work honestly
@tjblackman08
@tjblackman08 5 жыл бұрын
10:23 - How to handle nested arrays and objects (and why). Great vid, thanks!
@MichaelButlerC
@MichaelButlerC 10 ай бұрын
I know this video is 7 years old already, but thank you anyway! I'm glad to know the basics and core concepts when learning the current versions and how it evolved over time.
@ashleythomas3329
@ashleythomas3329 6 жыл бұрын
I just want to say thank you so much Every time I start learning something new, your channel is the place I go to get started. School would be much, MUCH harder if I hadn't found your channel
@academind
@academind 6 жыл бұрын
And I just want to say thank YOU for your fantastic feedback Ashley! It honestly makes me happy to read that the content on our channel makes your life a bit easier :)
@muhammadminhaj1968
@muhammadminhaj1968 4 жыл бұрын
You're really a great teacher for teaching us clear programming core concept. Thank you so so much.......
@himanshu2168
@himanshu2168 5 жыл бұрын
I'm very happy after saw this video You clear my doubt about how immutable state works... A big thanks from my side. keep helping us and good will give you everything you need.
@academind
@academind 5 жыл бұрын
Thanks a lot Himanshu, great to read that the video was helpful!
@jonyoinas1807
@jonyoinas1807 6 жыл бұрын
For the first time I really understood how the reducer works! ...state etc are no longer magic to me! Thank you so so much!
@academind
@academind 6 жыл бұрын
Thanks again for your awesome feedback Joni, really cool to read that the series is helpful!
@sweetbabyjesus1000
@sweetbabyjesus1000 7 жыл бұрын
Great stuff, thank you for taking the time to make a very good 'from the ground up' tutorial. Very clear explanations and a great pace as well.
@academind
@academind 7 жыл бұрын
Great to hear that, thanks so much Riley!
@kalia755
@kalia755 5 жыл бұрын
its really helpful and +1 for clarifying the spread operator and its overwriting behaviour.
@academind
@academind 5 жыл бұрын
Great to read that you liked it, thank you for your comment Kunal!
@maciejbak6907
@maciejbak6907 7 жыл бұрын
Nice described this "...state"
@dheerajmantena3307
@dheerajmantena3307 6 жыл бұрын
No.1 tutor forever @Max.....
@academind
@academind 6 жыл бұрын
Thanks again Dheeraj!
@dheerajmantena3307
@dheerajmantena3307 6 жыл бұрын
Welcome Max. Can you make tutorials at Udemy on Progressive web application using google Polymer with web-components(also Material design components) ? I am very much impressed with that technology...It makes life easy in the modern developer world . Kindly, Please look into it if you can and make some project .Thank you again Max.....
@SergioArroyoSailing
@SergioArroyoSailing 4 жыл бұрын
Thanks so much! bests simplest barebones explanation yet! Great idea to abstract away the other elements and just show Redux itself ! Keep up the great work! =)
@jean-baptistelasselle4562
@jean-baptistelasselle4562 Жыл бұрын
thank you so much, again, very good explanations, and so, the spread operator does what we generally calll a deep copy
@dharmisettynaveen883
@dharmisettynaveen883 4 жыл бұрын
Clear cut explanation sir
@rvlglobe
@rvlglobe 7 жыл бұрын
Golden nugget of knowldge, many thanks
@academind
@academind 7 жыл бұрын
Thanks so much for your comment!
@prashmai6368
@prashmai6368 4 жыл бұрын
great explaination max
@musicofMEC
@musicofMEC 4 жыл бұрын
Bro this video is amazing! Thank you, your explanation was top notch!
@generalco2554
@generalco2554 6 жыл бұрын
@4:25 I'm not quite clear on what happened here. How is result = 123 before the next addition and console.log is executed? How could it know unless the addition has already happened?
@igorbondarenko9854
@igorbondarenko9854 7 жыл бұрын
Finally I got it! Thanks!^)
@academind
@academind 7 жыл бұрын
Awesome to hear that, thanks for your nice feedback Igor!
@yash6680
@yash6680 6 жыл бұрын
11:00 -- TREASURE -- 12:00
@vikashgauravvkg
@vikashgauravvkg 5 жыл бұрын
yeah man, that was great. I was so confused for a while but later i figured it out
@franklins705
@franklins705 5 жыл бұрын
the only ambiguous item in this tutorial is variable "state" being passed in through the reducer parameters. How do you reference the old passed in "state" and the newly created "state" variable under each CASE clause?
@tambolaking5383
@tambolaking5383 4 жыл бұрын
I was making this mistake in my application. Thanks
@sylvain1099
@sylvain1099 8 жыл бұрын
That is very clear. Thanks for your tuto
@academind
@academind 8 жыл бұрын
Great to hear that, thanks a lot for your great feedback!
@mailtech4580
@mailtech4580 6 жыл бұрын
Great work man... Keep it up
@academind
@academind 6 жыл бұрын
Thanks so much for your great feedback, I'll try my best to keep it up!
@EdwardMarkovich
@EdwardMarkovich 6 жыл бұрын
Excellent. Very helpful.
@hothach80
@hothach80 7 жыл бұрын
hello, I have an error Uncaught TypeError: Cannot create property 'result' on number '1'. Help me, how to fix it
@sharvilakthakore8189
@sharvilakthakore8189 7 жыл бұрын
in CreateStore, don't initialise state with 1. i.e. const Store = CreateStore(Reducer) instead of const Store = CreateStore(Reducer,1) since we are using Object for state in place of a Number.
@gncfhcnvc
@gncfhcnvc 7 жыл бұрын
thanks for the information, i had the same mistake :D
@monisankarbarick1622
@monisankarbarick1622 6 жыл бұрын
Have any Tutorials for cart functionality?
@nicksergeev1641
@nicksergeev1641 4 жыл бұрын
Hi Max! Thank you for this video! But it is not fully clear to me why do you create state object without any variable creation statement(like var, let, const)? (line 44, 51) in the end of this video. Because in this case state is not an existing one object which you override so it is a little bit confusing. Thanks again
@madhurichinthakindi9909
@madhurichinthakindi9909 8 жыл бұрын
Hi Max, I am enjoying the videos so far but I get an error while using "..." as the REST operator, at line 45 (in your code). I tried solutions in here babeljs.io/docs/plugins/transform-object-rest-spread/ , that solved my problem when I use that as SPREAD, but the other one is throwing an error when I use it as REST. Could you give me a solution?
@ОлегВолков-р5ч
@ОлегВолков-р5ч 7 жыл бұрын
You can install babel-preset-state-2 package. Add it to webpack.config file query: { presets: ["react", "es2015", "stage-2"] }
@NIKHILYADAV-xm9ql
@NIKHILYADAV-xm9ql 3 жыл бұрын
Is reducer function is act same like setState method and we could consider this function also as changing state method (global state in redux store). What is the basic difference between setState method, useState hook and reducer function and when to use them Thank you 🙏🏻
@sushantr134
@sushantr134 6 жыл бұрын
Sir, Is it a good practice or bad Practice to use `{connect}` from 'redux' library in multiple components? For Example:- Login component import this and in Signup again import this to map the state to the props.
@ar5hadkhan
@ar5hadkhan 7 жыл бұрын
Spread operators for object is just a proposal, not part of es6. I got confused by reading SPREAD OPERATORS ARE ONLY FOR ITERABLES on MDN. I will prefer Object.assign over spread operators.
@ОлегВолков-р5ч
@ОлегВолков-р5ч 7 жыл бұрын
It`s good choice too but the advantage of using the object spread syntax becomes more apparent when you're composing complex objects.
@LucyPero
@LucyPero 7 жыл бұрын
You only have to add a plugin to Babel to make it work. More Info: redux.js.org/docs/recipes/UsingObjectSpreadOperator.html
@nuniezjorge
@nuniezjorge 2 жыл бұрын
so, redux is a tool for state management? how does it compare to bindings in xamarin (should i've said C#)?
@undefined125
@undefined125 5 жыл бұрын
Why if we mutate original state and log it to console, we see "{result: 101, ...}", but if we click on triangle and unwrap the object, there we see "result: 123" - from my perspective it looks like the same object at the same time has one property with two different values - how is that possible? Is that something related to asyc nature of JS? It breaks my mind...
@PS-dp8yg
@PS-dp8yg 8 жыл бұрын
Thank you very much for this video. Isn't reassigning state mutating state?
@academind
@academind 8 жыл бұрын
No, mutating state would mean "change the existing one". Re-assigning simply overwrite it, hence it replaces the object entirely. You could use a different/ new variable if you want though.
@pablobello0
@pablobello0 8 жыл бұрын
Very nice, thank you
@academind
@academind 8 жыл бұрын
Happy to hear that it's helpful! :)
@soixam7778
@soixam7778 8 жыл бұрын
thanks guys for share :D
@academind
@academind 8 жыл бұрын
Happy you're liking it!
@pbsingh205
@pbsingh205 6 жыл бұрын
i want to know how to toggle between profile and dashboard using redux... how it should be done in much effecient way... please tell me
@HASHlRAMA
@HASHlRAMA 7 жыл бұрын
I don't understand what is the old object, and new object. even if there were older states being used somewhere, wouldn't the object returned from store.getState() should only point to the new object? how come it console.logs both the old object and new object?
@JuanPareles
@JuanPareles 7 жыл бұрын
That was heavy but I think I am starting to understand it
@academind
@academind 7 жыл бұрын
Great to hear that Juan!
@kbongers
@kbongers 7 жыл бұрын
When will you be updating this series? Pretty much everything is out of date and I'm encountering issues at just about every step. It's pretty much impossible to follow along now.
@academind
@academind 7 жыл бұрын
I might create a new series in the future yes - got no concrete plans as of now. Or, to be precise: Got other ongoing projects + plans I need/ want to finish first.
@asmaashfaq8881
@asmaashfaq8881 6 жыл бұрын
Everything is going fine with me up till now
@drjones694
@drjones694 5 жыл бұрын
Thank you!!!!
@abdullahialiyu2875
@abdullahialiyu2875 7 жыл бұрын
I get an error when with ...state, result: state.result + action.payload And I cant find this specific branch on github to compare my code
@RamonAdanPentester
@RamonAdanPentester 7 жыл бұрын
You need install babel-preset-stage-2 (npm i --save-dev babel-preset-stage-2) because Spread Operator for objets is a proposal, and not be included in ES6
@ducksauce6437
@ducksauce6437 7 жыл бұрын
Sir i found this to be a better approach to write reducers. (BY USING OBJECT ASSIGN METHOD) const addReducer = (state={value : 1,array : []},action)=> { switch (action.type) { case "ADD": return Object.assign({}, //empty object state, //previous state {value:state.value+action.payload,array:[state.array,state.value+action.payload]}) //new changes break; case "SUB": return Object.assign({}, state, {value:state.value-action.payload,array:[state.array,state.value+action.payload]}) default: return state; //you need to return the previous state because store calls all reducers and this reducer //needs to return the previous state in case we donot intend to call this reducer } };
@sudhanshutripathi85
@sudhanshutripathi85 7 жыл бұрын
wow explanation.
@academind
@academind 7 жыл бұрын
So happy to read that, thank you so much!
@lovepanchal8387
@lovepanchal8387 5 жыл бұрын
show an error Cannot read property 'result' of undefined
@moniteddy1274
@moniteddy1274 7 жыл бұрын
Cannot convert undefined or null to object
@abdennaceurnebhen7011
@abdennaceurnebhen7011 6 жыл бұрын
great
@academind
@academind 6 жыл бұрын
Thanks so much!
@metitusable
@metitusable 6 жыл бұрын
You're over using the const keyword. It might to have the same meaning as in other languages but it's still called const for a reason. If you set a const to an object, which shouldn't be valid anyway, if you change the value of the properties of that object, then your object is not a constant. Consider changing that.
@kylehassett8596
@kylehassett8596 6 жыл бұрын
Just use Object.assign() and skip the majority of this video. No need to use the ... syntax unless there are subobjects that you have to handle. If you don't want to worry about even that, use the package lowdash's merge method
@johnb8739
@johnb8739 7 жыл бұрын
You should have created a udemy course on react and redux
@academind
@academind 7 жыл бұрын
I think React/ Redux is already covered pretty well on Udemy :)
@scikick
@scikick 6 жыл бұрын
9 people use IE8.
@nawabali385
@nawabali385 5 жыл бұрын
seriously! I dont want to hurt you but I can not understand this code. please try to make sure that people with no good english could understand you :)
@MSandrade0
@MSandrade0 7 жыл бұрын
Amazing thank you so much !
@academind
@academind 7 жыл бұрын
You're welcome - I'm glad that this was helpful Olivier!
@uqairali6282
@uqairali6282 6 жыл бұрын
great
ReactJS / Redux Tutorial - #5 Multiple Reducers
6:18
Academind
Рет қаралды 78 М.
Immutability in JavaScript
15:13
Steve Griffith - Prof3ssorSt3v3
Рет қаралды 7 М.
If people acted like cats 🙀😹 LeoNata family #shorts
00:22
LeoNata Family
Рет қаралды 35 МЛН
SIZE DOESN’T MATTER @benjaminjiujitsu
00:46
Natan por Aí
Рет қаралды 8 МЛН
Accompanying my daughter to practice dance is so annoying #funny #cute#comedy
00:17
Funny daughter's daily life
Рет қаралды 25 МЛН
Quilt Challenge, No Skills, Just Luck#Funnyfamily #Partygames #Funny
00:32
Family Games Media
Рет қаралды 45 МЛН
ReactJS / Redux Tutorial - #7 Connect ReactJS and Redux
20:00
Academind
Рет қаралды 97 М.
Immer.js Crash Course - And Why Immutability Is Very Important ⚡
10:00
Mehul - Codedamn
Рет қаралды 17 М.
Immutability - Computerphile
10:05
Computerphile
Рет қаралды 97 М.
Immutable.js Tutorial - The Advantages of Using Immutable.js
14:14
Fullstack Academy
Рет қаралды 20 М.
You might not need useEffect() ...
21:45
Academind
Рет қаралды 175 М.
Why I Moved from React Redux to Zustand and Why You Should Too!
19:24
Why you can't change state directly in React?
15:44
Juriy Bura
Рет қаралды 8 М.
Redux Sagas vs Redux Toolkit Query
22:58
Jack Herrington
Рет қаралды 36 М.
ReactJS / Redux Tutorial - #10 Async Actions
10:08
Academind
Рет қаралды 85 М.
If people acted like cats 🙀😹 LeoNata family #shorts
00:22
LeoNata Family
Рет қаралды 35 МЛН