digitalfabrik/integreat-app

View on GitHub
native/src/hooks/useReportError.ts

Summary

Maintainability
A
0 mins
Test Coverage
A
100%
import { useEffect } from 'react'

import { reportError } from '../utils/sentry'

const useReportError = (error: Error | null): void => {
  useEffect(() => {
    if (error !== null) {
      reportError(error)
    }
  }, [error])
}

export default useReportError