Skip to content

Commit 73bb80a

Browse files
committed
migrate asyncError to ts
1 parent 1aa51d4 commit 73bb80a

3 files changed

Lines changed: 14 additions & 15 deletions

File tree

src/features/remoteConfig/providers/ConfigurationWrapper.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import React from 'react'
2-
import useAsyncError from 'src/hooks/useAsyncError'
2+
import { useAsyncError } from 'src/hooks/useAsyncError'
33
import { useGetRemoteConfig } from '../api/getRemoteConfig'
44
import BeatLoader from 'react-spinners/BeatLoader'
55

src/hooks/useAsyncError.js

Lines changed: 0 additions & 14 deletions
This file was deleted.

src/hooks/useAsyncError.tsx

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
import { useCallback, useState } from 'react'
2+
3+
export const useAsyncError = () => {
4+
const [, setError] = useState()
5+
return useCallback(
6+
(e: string) => {
7+
setError(() => {
8+
throw e
9+
})
10+
},
11+
[setError]
12+
)
13+
}

0 commit comments

Comments
 (0)