Custom React hook that triggers a callback when the observable property changes.
This hook compares the current value of the observable property with its previous value.
If they differ, it invokes the provided observer function with the current and previous values.
Custom React hook that triggers a callback when the observable property changes.
This hook compares the current value of the observable property with its previous value. If they differ, it invokes the provided observer function with the current and previous values.
Example