I'm trying to understand why a change in my component B triggers a re-render of component A and his children.
component A has a useSelector for store.A.
component B has a useSelector for store.B.
store A and store B are under the same AppStore.
component A has several children components that are not connected to the store (component A retrieves all the data needed from the store and passes it as props).
When component B calls an action that modifies store B, useSelector is called in both components.
Here comes the catch:
If I write a useEffect that watches all the data retrieved via useSelector in component A, it never triggers when interacting with component B.
But it re-renders all the child components all the same.
I've tried to React.memo a child component of component A, and no change, it always re-renders component A and all his children, even when its props doesn't change (or so is telling me the useEffect watching all the component props).
Note 1: all components are functional.
Note 2: if component B only changes its local state and doesn't call any redux actions, component A is never re-rendered.
I also double checked that all the functions passed as props are using useCallback.
I really don't understand what is going on.
I thought that if a component props don't change, they shouldn't re-render.