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

Was this helpful?

  1. API

loadApiCache

Load cached API data

src/index.jsx
import React from 'react'
import ReactDOM from 'react-dom'
import { ApiProvider, loadApiCache } from 'react-use-api'

import App from './components/App'

const rootElement = document.getElementById('root')
const method = rootElement.hasChildNodes() ? 'hydrate' : 'render'

loadApiCache()

ReactDOM[method](
  <ApiProvider>
    <App />
  </ApiProvider>,
  rootElement
)
PreviousinjectSSRHtmlNextSSR Settings

Last updated 5 years ago

Was this helpful?