Skip to content

Instantly share code, notes, and snippets.

@michael-mckenna
Created June 4, 2021 18:43
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save michael-mckenna/056baea580d6d7bc0f5013f8dee0bf4d to your computer and use it in GitHub Desktop.
Save michael-mckenna/056baea580d6d7bc0f5013f8dee0bf4d to your computer and use it in GitHub Desktop.
// gets the channel id of the currently selected channel
export const selectCurrentChannelId = createSelector(
selectMessagesState,
getSelectedChannelId
);
export const selectMessageEntities = createSelector(
selectMessagesState,
selectMessageContainerEntities
);
// Gets messages for the currently selected channel
export const selectCurrentChannelMessages = createSelector(
selectMessageEntities,
selectCurrentChannelId,
(messageEntities, channelId) => messageEntities[channelId].messages
);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment