Hey there,

if I’m not mistaken, when you are not accessing the components props, then the selector you were already using in your connect() will work just find in the useSelector() hook.

Of course, the selector function is not memoized by default, but that should not pose an issue if you were using a simple function that was not created through a selector function factory (i.e. makeMapStateToProps ). So, as long as you are using the same function that selects the state pieces and you are not accessing the props of the component within it, you can safely re-use it.

Outside the context of this article, selectors are good both for abstraction and performance. Abstraction because you abstract away the “how this data is computed” and performance because you can use reselect and other memoization libraries to make sure that you get referentially the same data regardless the amount of re-renders (supposing that the data is actually the same if you did a shallow comparison).Using useStore + useMemo forces you to get away from doing things the “redux way” and you are just treating the store state as a simple object :P

Please feel free to correct me if I’m wrong in any of the points above, since I might have misunderstood something. If that’s the case please elaborate some more so I can fully get what you mean.

Thanks in advance man (and also thank you for the nice words :))

Front-end ReactJS Developer — https://aggelos.dev

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store