To be honest, I”m a little disappointed in the new reactivity system. I think if it’s immutable, the final code is more strict, predictable and cleaner. Especially in case of junior devs. I mean, deep object reactivity is unnecessary because if you have something like users[index].info.cats.push(newCat), you more likely have spaghetti code and should restructure this component.
By the way, will deep object mutation trigger updates only in specific child component?
Hey! I'm YCMJason, a Software Engineer in London 👨💻. Love diving into tech puzzles and sharing them! 🧩
All views expressed here are my own opinions, so please take them with a pinch of salt! 🧂
Why would .push more likely to introduce spaghetti code?
Will deep object mutation trigger updates only in specific child component?
Yes.
A component will only re-render if the dependencies of the render function are changed. So if a child component do not depend on the "deep object mutation", then it should not be re-rendered.
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.
Nice article, thank you!
To be honest, I”m a little disappointed in the new reactivity system. I think if it’s immutable, the final code is more strict, predictable and cleaner. Especially in case of junior devs. I mean, deep object reactivity is unnecessary because if you have something like users[index].info.cats.push(newCat), you more likely have spaghetti code and should restructure this component.
By the way, will deep object mutation trigger updates only in specific child component?
Why would
.push
more likely to introduce spaghetti code?Yes.
A component will only re-render if the dependencies of the render function are changed. So if a child component do not depend on the "deep object mutation", then it should not be re-rendered.