Reusing extraSelectors
in the createFeature
#3774
Answered
by
markostanimirovic
alex-aghamyan-volo
asked this question in
Q&A
-
Hi there. |
Beta Was this translation helpful? Give feedback.
Answered by
markostanimirovic
Feb 10, 2023
Replies: 1 comment 3 replies
-
Hi @alex-aghamyan-volo 👋 You can define export const counterFeature = createFeature({
name: 'counter',
reducer: createReducer({ count: 0 }),
// 👇
extraSelectors({ selectCount }) {
const selectCountPlus1 = createSelector(
selectCount,
(count) => count + 1
);
const selectCountPlus2 = createSelector(
// 👇
selectCountPlus1,
(count) => count + 1
);
return { selectCountPlus1, selectCountPlus2 };
},
}); |
Beta Was this translation helpful? Give feedback.
3 replies
Answer selected by
alex-aghamyan-volo
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Hi @alex-aghamyan-volo 👋
You can define
extraSelectors
factory in the following way: