Comment

Comment by benjaminjackman

Having experimented with and used proxies a decent amount, the MDN page is my goto reference when I need to use them: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Refe...

The biggest pitfalls, in my experience are

1. Infinite recursion when implementing get and printing proxies with console.log in node.js (which attempts to access properties from the object prototype which can lead to infinite recursion problems).

2. Performance, which I would need to do more digging and benchmarking to comment on in more depth.

Some libraries that use Proxies to great effect are the https://github.com/mobxjs/mobx-state-tree and https://github.com/mweststrate/immer libraries both by mweststrate

Discussion

Live from the official Hacker News API

A modern reader for Hacker News · SvelteKit + Skeleton