In my react application, lets say I have some data which is needed by both a parent component and its immediate child. The application uses redux for state management.
Now, in the child component, I can use useSelector
and get the sate. But as I already have the information in the parent (in case it matters, I also got using useSelector
), I simply pass props to the child like <Child info={someInfo} />
. Here is Child
is child component and someInfo
is the sate information I got using useSelector
.
My question is, should I pass props in this case or get the data using useSelector
in child component. Moreover, will passing props be faster than instead of reading using useSelector
and vice-versa?