Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Do we get object immutability automatically when using ngrx or ngxs?

Do we automatically get object immutability for all domain instances when using NGRX or NGXS? Most of the contexts that I read up on seem to indicate this, but there's also wording like"When we use NGRX with immutable objects ...", so just want to double check that we are not suppose to use something like immutable.js in addition to ngrx?

like image 636
Ole Avatar asked Oct 20 '25 21:10

Ole


1 Answers

No, we don't. If you don't use immutable library, passed payloads must be deeply cloned manually inside reducer (NGRX) or action handler (NGXS) before added to the state.

like image 96
Zygimantas Avatar answered Oct 22 '25 12:10

Zygimantas



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!