Hooks
Some hooks that can be used with@kubb/react
.
useLifecycle
useLifecycle
will return some helpers to exit/restart the generation.
tsx
import { useCli } from '@kubb/react'function Component() { const { exit } = useLifecycle() return null}
useApp
useApp
will return the current App with plugin, pluginManager, fileManager, mode, ...
tsx
import { useApp } from '@kubb/react'function Component() { const { pluginManager, plugin, mode, exit, getFile, fileManager} = useApp() return null}
useFile
WithuseFile
you can get the context of the current file(basePath, name, ...)
tsx
import { File, useFile } from '@kubb/react'function Component() { const pluginName = 'custom-plugin' const file = useFile() return file.baseName}