FaasJS
Home
  • Guide
  • Documents
  • Starter Template
  • Changelog
  • Ecosystem

    • VS Code Plugin
    • Docker Images
  • Github
  • Contributing
  • Sponsor
  • Security
  • English
  • 简体中文
Home
  • Guide
  • Documents
  • Starter Template
  • Changelog
  • Ecosystem

    • VS Code Plugin
    • Docker Images
  • Github
  • Contributing
  • Sponsor
  • Security
  • English
  • 简体中文

Documents / @faasjs/ant-design / withFaasData

Function: withFaasData()

withFaasData<PathOrData, TComponentProps>(Component, faasProps): FC<Omit<TComponentProps, keyof FaasDataInjection<PathOrData>>>

HOC to wrap a component with FaasDataWrapper and Loading

Type Parameters

PathOrData

PathOrData extends FaasActionUnionType

TComponentProps

TComponentProps extends Required<Partial<FaasDataInjection<PathOrData>>> = Required<Partial<FaasDataInjection<PathOrData>>>

Parameters

Component

FC<TComponentProps & Record<string, any>>

faasProps

FaasDataWrapperProps<PathOrData>

Returns

FC<Omit<TComponentProps, keyof FaasDataInjection<PathOrData>>>

Example

const MyComponent = withFaasData(({ data }) => <div>{data.name}</div>, { action: 'test', params: { a: 1 } })