I have this selector:
const selectListOfApplicationIdAndApplicationCompany = state => Object.values(state.applications.dict).map((x) => ({"id": x.id, "companyName": x.companyName}));
I am getting a warning from React saying that this selector should be memoized because it is returning a different object for same input parameters. I understand why that is happening. I started reading through the Redux documentation about createSelector. I did read their simple examples, but I still dont understand how to memoize the selector I have.
I have tried to do just:
export const selectListOfApplicationIdAndApplicationCompany = createSelector([_selectListOfApplicationIdAndApplicationCompany], (data) => data);
That is returning a “The result function returned its own inputs without modification. e.g
createSelector([state => state.todos], todos => todos)
This could lead to inefficient memoization and unnecessary re-renders.
Ensure transformation logic is in the result function, and extraction logic is in the input selectors.” warning.
The documentation talks about “input selectors” and “output selectors”. I do not understand what part of my original selector is the input and output, or even if I can break that selector into two parts …