React Use API
  • Introduction
  • Usage
    • Getting Started
    • Advanced Usage
      • List API and Pagination
      • Request Control
      • Data Processing
      • Side-Effect Dependencies
      • Watch option
    • TypeScript
  • API
    • useApi
    • State
    • Request Function
    • ApiProvider
    • injectSSRHtml
    • loadApiCache
  • Server Side Rendering
    • SSR Settings
    • Examples
      • Real World Examples
      • With Ant Design
Powered by GitBook
On this page
  • Code
  • Request Arguments

Was this helpful?

  1. API

Request Function

Code

const [data, state, request] = useApi(config, options)

// request the API data again
request(config?: ReactUseApi.Config, keepState = false)

Request Arguments

A function allows requesting API data again. This function will trigger re-render.

Name

Type

Default

Description

config

ReactUseApi.Config

The config passed from useApi()

An axios' config object to fetch API data.

keepState

boolean

false

Set to true to maintain current state data, which facilitates combining previous data with current data, such as table list data.

PreviousStateNextApiProvider

Last updated 5 years ago

Was this helpful?