【发布时间】:2021-05-22 03:24:28
【问题描述】:
我无法理解来自https://github.com/bvaughn/react-error-boundary/blob/master/src/index.tsx 的以下源代码中 void 的用途。谁能解释一下?
function useErrorHandler(givenError?: unknown): (error: unknown) => void {
const [error, setError] = React.useState<unknown>(null)
if (givenError != null) throw givenError
if (error != null) throw error
return setError
}
【问题讨论】:
标签: typescript void arrow-functions