Documents / @faasjs/ant-design / withFaasData
Function: withFaasData()
withFaasData<
PathOrData
,TComponentProps
>(Component
,faasProps
):React.FC
<Omit
<TComponentProps
, keyofFaasDataInjection
<PathOrData
>> &Record
<string
,any
>>
HOC to wrap a component with FaasDataWrapper and Loading
Type Parameters
• PathOrData extends FaasAction
• TComponentProps extends Required
<Partial
<FaasDataInjection
<PathOrData
>>> = Required
<Partial
<FaasDataInjection
<PathOrData
>>>
Parameters
• Component: FC
<TComponentProps
& Record
<string
, any
>>
• faasProps: FaasDataWrapperProps
<PathOrData
>
Returns
React.FC
<Omit
<TComponentProps
, keyof FaasDataInjection
<PathOrData
>> & Record
<string
, any
>>
Example
const MyComponent = withFaasData(({ data }) => <div>{data.name}</div>, { action: 'test', params: { a: 1 } })