At react-redux's hooks documentation we are warned that useSelector "does not prevent the component from re-rendering due to its parent re-rendering, even if the component's props did not change," unlike connect
This is news to me. Does connect prevent re-rendering where a normal child component would not re-render? More specifically, I'm asking about the difference in the re-rendering behavior of the below three scenarios when the parent component re-renders while the store and props remain unchanged:
- The child component is wrapped in a
connectHOC. - Behavior as 1., but injected state is refactored into
useSelector. - As 2., but
useSelectorand everything dependent on it is removed.