When using the useSelector hook, a console warning is shown instructing the user to memoize the result.

Since getFlashMessages returns new array, it will always trigger a re-render of its component (the default comparator is shallow equals, i.e., ===).
This is especially worrisome because it's usually included in the top Layout component within our client repos and will trigger a re-render after every action is handled and updates state somewhere in the tree, which could have a cascading effect on triggering child re-renders throughout the app.
Potential solutions:
- Don't export selectors
- Use
createSelector from reselect to memoize the selectors
When using the

useSelectorhook, a console warning is shown instructing the user to memoize the result.Since
getFlashMessagesreturns new array, it will always trigger a re-render of its component (the default comparator is shallow equals, i.e.,===).This is especially worrisome because it's usually included in the top
Layoutcomponent within our client repos and will trigger a re-render after every action is handled and updates state somewhere in the tree, which could have a cascading effect on triggering child re-renders throughout the app.Potential solutions:
createSelectorfromreselectto memoize the selectors