Classy Store

subscribeKey

Watch separate property logs while changing the count or name.

subscribeKey

Subscribe to changes on a single property. Other property changes don't trigger the callback.

Count: 0Name: Alice
renders: 1
subscribeKey('count') log

No events yet

subscribeKey('name') log

No events yet

API · subscribeKey(store, key, callback, options?): () => void from @codebelt/classy-store/utils.

The subscription compares each property using Object.is. Updating the other property leaves its log alone.

On this page