I am new to Redux and Redux toolkit. I learned that createSelector
can accept multiple input selectors, which can be provided as separate arguments or as an array. The results from all the input selectors are provided as separate arguments to the output selector.
const selectA = state => state.a;
const selectB = state => state.b;
const selectC = state => state.c;
const selectABC = createSelector(
[selectA, selectB, selectC],
(a, b, c) => {
// do something with a, b, and c, and return a result
return a + b + c;
}
);
my question is, if I only care about one simple state, can I just use useSelector
like this
const selectA = state => state.a;
const a = useSelector(selectA)
what's the difference between the two usages?