Skip to content

Instantly share code, notes, and snippets.

@talkol
Created October 15, 2016 21:33
Show Gist options
  • Select an option

  • Save talkol/372c673079bb8d4da43532fe402c5071 to your computer and use it in GitHub Desktop.

Select an option

Save talkol/372c673079bb8d4da43532fe402c5071 to your computer and use it in GitHub Desktop.
export function getPosts(state) {
const currentFilter = state.posts.currentFilter;
const postsById = state.posts.postsById;
const postsIdArray = currentFilter === 'all' ?
_.keys(postsById) :
_.filter(_.keys(postsById), (postId) => postsById[postId].topicUrl === currentFilter);
return [postsById, postsIdArray];
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment