初始化模版工程
This commit is contained in:
15
components/nova-sdk/context/useNovaKit.ts
Normal file
15
components/nova-sdk/context/useNovaKit.ts
Normal file
@@ -0,0 +1,15 @@
|
||||
import { useContext } from 'react'
|
||||
import { NovaKitContext } from './context'
|
||||
import type { NovaKitContextValue } from '../types'
|
||||
|
||||
/**
|
||||
* Hook 获取 NovaKit Context
|
||||
*/
|
||||
export function useNovaKit(): NovaKitContextValue {
|
||||
const context = useContext(NovaKitContext)
|
||||
if (!context) {
|
||||
throw new Error('useNovaKit must be used within a NovaKitProvider')
|
||||
}
|
||||
return context
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user