I have a redux store like so:
{
'1f458697-e2c0-4d11-ada0-ee7b113c2429': {
name: 'Jim',
title: 'Developer',
active: true
},
'4498eb08-3786-495a-a66c-21a65138ab24': {
name: 'Darren',
title: 'Human Resources',
active: false
},
'c7975551-153f-4eab-a875-ed5445f76252': {
name: 'Francesa',
title: 'Chief of Internal Operations',
active: false
}
}
And I have a selector that gets an active user.
export const getActiveUser = (users) => _.find(users, { 'active': true });
My question is, whats the nicest way to include the ID of the user in the payload to use within my React component:
Is this is a bad practice and a sign that I should be using an array instead.
Should I just change my user payload to include the ID. This feels wrong as I would be duplicating data.
Should I manipulate that specific selector to include the users ID.