Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Detecting object changes vs. functional-style purity #24

Open
rkrisztian opened this issue Jul 11, 2022 · 1 comment
Open

Detecting object changes vs. functional-style purity #24

rkrisztian opened this issue Jul 11, 2022 · 1 comment

Comments

@rkrisztian
Copy link

rkrisztian commented Jul 11, 2022

I've read this article: https://daily-dev-tips.com/posts/detect-object-changes-with-javascript-proxy/

I think it's great to know about this technique, but I also think it's important to point out that in the functional-style world, you would never mutate an object, but instead create a new one by transforming the existing one. Then whatever needs to monitor changes would simply check if the reference changed. This is how Angular change detection works by default, for example.

I'm not saying proxy-based change detection is bad, I'm just saying the article should tell about both approaches (at least mention the functional-style way).

@rebelchris
Copy link
Collaborator

Hi @rkrisztian Thanks for the amazing suggestion.

I think proxy based change detection is one of the simpler examples of not scaring people from proxies, but agree it could have some alternative pointers.

The whole reason for the article came down to using it for proxying the existing fetch requests. 😅

I wanted to check if you wanted to help contribute to the article by adding the functional style change detection as a alternative heading?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants