Add utility to watch for changes in certain values
This will be used to streamline a common pattern in our code for reacting to changes in state selected from the central Redux store. The utility is a standalone function rather than a method of the store so that it can easily be used with mock stores and also other data sources in future. ``` watch( store.subscribe, () => store.getState().someValue, (currentValue, prevValue) => { /* Handle change */ }, ); ```
Showing
src/sidebar/util/watch.js
0 → 100644
Please register or sign in to comment