Documents / @faasjs/test / useFunc
Function: useFunc()
useFunc<
TEvent
,TContext
,TResult
>(handler
):Func
<TEvent
,TContext
,TResult
>
// pure function
export default useFunc(() => {
return () => {
return 'Hello World'
}
})
// with http
import { useHttp } from '@faasjs/http'
export default useFunc(() => {
const http = useHttp<{ name: string }>()
return () => {
return `Hello ${http.params.name}`
}
})
Type parameters
• TEvent = any
• TContext = any
• TResult = any
Parameters
• handler
Returns
Func
<TEvent
, TContext
, TResult
>