department-of-veterans-affairs/vets-website

View on GitHub
src/applications/check-in/hooks/useUpdateError.jsx

Summary

Maintainability
A
0 mins
Test Coverage
import { useCallback } from 'react';
import { useDispatch } from 'react-redux';
import { setError } from '../actions/universal';

const useUpdateError = () => {
  const dispatch = useDispatch();
  // @TODO add unit tests once this does something more
  const updateError = useCallback(
    error => {
      dispatch(setError(error));
    },
    [dispatch],
  );

  return { updateError };
};

export { useUpdateError };