DEV Community

loading...

Discussion on: State Management with a Single Line of Code

Collapse
kgignatyev profile image
Konstantin Ignatyev

Interesting idea, but 'working' assignments which do nothing is very bad idea.

newValue.c = 'hehe' // works, but

dataUnit.value() // still {c: 3}

that is not acceptable IMO, must throw exception

Collapse
dabalyan profile image
Ankit Singh Author

thanks :)

There's an option to enable that behavior as well, but it's only recommended to be used in development mode, see checkImmutability flag in docs.activejs.dev/guides/developme...

Collapse
kgignatyev profile image
Konstantin Ignatyev

Well, I think that should be the only behavior.

Thread Thread
dabalyan profile image
Ankit Singh Author

ActiveJS is configured with most sensible defaults, and gives you the ability to configure it in your own way.

You can keep the checkImmutability check on in the production as well, but it's not something that ActiveJS or people much smarter than me recommend :)