import { useRecoilValue } from 'recoil';
import { sortedDelegateCandidates } from "../../../atoms/election/index.js";

/**
 * @param {object} opts
 * @param {string} opts.party
 * @param {string} [opts.stateFips]
 */
const useSortedDelegates = function useSortedDelegates(opts) {
  const {
    party,
    stateFips
  } = opts;
  return useRecoilValue(sortedDelegateCandidates({
    party,
    stateFips
  }));
};
export default useSortedDelegates;