Module

useApi

Custom Hook for retrieving a Spark API Interface

If you know the name and version of an API interface managed by the API Manager, you can use this hook to get an instance of that api interface.

import { useApi } from '@jcu/spark'

export default function MyComponent() {

    // get version 1 of the vampire-information api interface
    const vampireApi = useApi('vampires', '1')

    // now you can call vampireApi.getInfo('dracula') to find out about Dracula.
}

View Source tools/hooks/useApi.ts, line 7