R
R
real22102020-04-16 12:30:08
React
real2210, 2020-04-16 12:30:08

Can I return a new object in createSelector?

There is a regular selector: How can I get part of the data of the entire object, I did it through createSelector:

const selectUserData = state => state.user.data;


export const selectUserSomeData = createSelector(selectUserData, userData => {
    return {
        id: userData.id,
        name: userData.name,
        email: userData.email
    }
})


I don't know why, but I think it's bad practice.
What is the right way to implement this?

Answer the question

In order to leave comments, you need to log in

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question