Closed inikonorov closed 1 year ago
createSelector
always forwards all arguments to all input selectors.
If I have:
const firstInput = (a, b, c) => a;
const secondInput = (a, b, c) => b;
const finalSelector = createSelector(
firstInput,
secondInput,
(a, b) => a + b
)
then when I call finalSelector(1, 2, 3)
, it will call firstInput(1, 2, 3)
and `secondInput(1, 2, 3).
But no, your example of useSelector(selectAnything)
will not work, because it needs two arguments, and useSelector
only passes in one argument: state
.
This is more obvious if you use TypeScript, which will show you exactly how many arguments the final selector requires.
I have the selector:
This selector I can call in component:
How can I call this selector in other selectors?
Can I call this selector that way?