JavaScript Proxies

up:: JavaScript With proxies, you can monitor objects for changes.

Whenever the object changes, you can intercept the change and modify it.

const data = {
	message: "Hello!"
const handler = {
	set(target, key, value) {
		// a so called 'set trap'
const proxy = new Proxy(data, handler);
// Proxy wraps the data object
  • target: target object
  • key: key of the changed object
  • value: value of the changed object

This is the basis for state in Vue, React or Nuxt.