Is there a method to create a "data updated" indicator when I am not interested in the actual updated data itself? Consider a scenario with a reducer:
const initialState: SomeReducer = {
dataInQuestion: Array<SomeDto>,
...
}
Following an action -> effect -> action -> reducer chain will modify dataInQuestion
, and I want to be alerted about this without needing the new data. The solution I devised may seem questionable at first glance and goes against the pure function principle.
const selectDataInQuestion => createSelector(selectSometing, (state: SomeReducer) => state.dataInQuestion);
const getDataInQuestionUpdate => createSelector(selectDataInQuestion, () => Math.random());
// Using Math.random() to ensure a new value is always generated :)
While I can simply use a selector for dataInQuestion
and disregard the assigned value, I was intrigued if there is a more efficient way to achieve this. Perhaps there exists a best practice for handling such scenarios.