'useReducer would be much better to deal with nested objects inside a state'
-what is the benefit of that? writing more code? setup reducer and dispatch actions when u still keep state as an object and can just copy an object and use same setState function. Same performance too. But much better.
The reason of not having to do a copy of the object every time should be compelling enough.
I dont understand what is wrong with making copy of object? u try save memory? u try save what?
So when calling useState u create a state var and a method setState:
const [state.setState] =useState('');
when u put each value in your own useState u create a bunch of independent setState methods takes space, which can be replaced with one setState if initial state was an object. compelling enough?)))
Lets say u have 30 fields? what a noise in code, what a waste)))
If somebody is expecting to have everything served on a silver plate, learning new things will be harder and harder over time 🙁
Brother, learning will be harder overtime no matter what, that is why we are here, to help and explain. dont be like that, just be good and bring to the table =)
For further actions, you may consider blocking this person and/or reporting abuse
We're a place where coders share, stay up-to-date and grow their careers.
'useReducer would be much better to deal with nested objects inside a state'
-what is the benefit of that? writing more code? setup reducer and dispatch actions when u still keep state as an object and can just copy an object and use same setState function. Same performance too. But much better.
The reason of not having to do a copy of the object every time should be compelling enough.
I dont understand what is wrong with making copy of object? u try save memory? u try save what?
So when calling useState u create a state var and a method setState:
const [state.setState] =useState('');
when u put each value in your own useState u create a bunch of independent setState methods takes space, which can be replaced with one setState if initial state was an object. compelling enough?)))
Lets say u have 30 fields? what a noise in code, what a waste)))
If somebody is expecting to have everything served on a silver plate, learning new things will be harder and harder over time 🙁
Brother, learning will be harder overtime no matter what, that is why we are here, to help and explain. dont be like that, just be good and bring to the table =)