How to use the redux-query.querySelectors.lastUpdated function in redux-query

To help you get started, we’ve selected a few redux-query examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github amplitude / redux-query / examples / async / src / containers / App.js View on Github external
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,
  };
};
github amplitude / redux-query / packages / redux-query-react / src / hooks / use-query-state.js View on Github external
const lastUpdated = useSelector(state =>
    querySelectors.lastUpdated(queriesSelector(state), queryConfig),
  );