Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
const mapStateToProps = state => {
const { selectedReddit } = state;
const url = getRedditUrl(selectedReddit);
const queriesState = get(state, 'queries');
const isFetching = querySelectors.isPending(queriesState, { url }) || false;
const lastUpdated = querySelectors.lastUpdated(queriesState, { url });
const postIds = get(state, ['entities', 'reddits', selectedReddit, 'data', 'children'], []);
const posts = postIds.map(id => get(state, ['entities', 'posts', id]));
return {
selectedReddit,
posts,
isFetching,
lastUpdated,
};
};
const isPending = useSelector(state =>
querySelectors.isPending(queriesSelector(state), queryConfig),
);