Skip to content

Hooks

Some hooks that can be used with @kubb/swagger.
See Oas to understand how to use the Oas instance or the Oas schemas.

useOas

useOas will return the Oas instance.

typescript
import { useOas } from '@kubb/react'

function Component() {
  const oas = useOas()

  return null
}

useOperation

useOperation will return the current Operation.

typescript
import { useOperation } from '@kubb/react'

function Component() {
  const operation = useOperation()

  return null
}

useOperations

useOperations will return all the Operations.

typescript
import { useOperations } from '@kubb/react'

function Component() {
  const operations = useOperations()

  return null
}

useOperationManager

useOperationManager will return some helper functions that can be used to get the operation file, get the operation name.

typescript
import { useOperationManager } from '@kubb/react'

function Component() {
  const { getName, getFile } = useOperationManager()

  return null
}

Released under the MIT License.