The type of the target.
A proxied object, array, or any other value.
The underlying (unproxied) data, or the input value if it wasn't a proxy.
const userProxy = proxy({ name: 'Frank' });
const rawUser = unproxy(userProxy);
// Log reactively
$(() => console.log('proxied', userProxy.name));
// The following will only ever log once, as we're not subscribing to any observable
$(() => console.log('unproxied', rawUser.name));
// This cause the first log to run again:
setTimeout(() => userProxy.name += '!', 1000);
// This doesn't cause any new logs:
setTimeout(() => rawUser.name += '?', 2000);
// Both userProxy and rawUser end up as `{name: 'Frank!?'}`
setTimeout(() => {
console.log('final proxied', userProxy)
console.log('final unproxied', rawUser)
}, 3000);
Returns the original, underlying data target from a reactive proxy created by proxy. If the input
target
is not a proxy, it is returned directly.This is useful when you want to avoid triggering subscriptions during read operations or re-executes during write operations. Using peek is an alternative way to achieve this.