| ▲ | anamexis 4 days ago | ||||||||||||||||||||||||||||||||||||||||||||||
I don’t know if I’d call it an idiom — rather I’d argue that in modern JavaScript, mutating passed objects is often an anti-pattern. | |||||||||||||||||||||||||||||||||||||||||||||||
| ▲ | dashersw 4 days ago | parent [-] | ||||||||||||||||||||||||||||||||||||||||||||||
I personally agree. But the default expectation (and therefore the design) should follow the practices of the language. If JS allows mutations on the objects passed to a function to be reflected on the parent, I believe frameworks should follow this paradigm. And in the end in Gea developers have full control over this, just in the same way they do in real life. `child({ ...obj })` easily solves this, for example, in both idiomatic JS and in Gea. | |||||||||||||||||||||||||||||||||||||||||||||||
| |||||||||||||||||||||||||||||||||||||||||||||||