use new docs
This commit is contained in:
11
packages/docs/src/helpers/lazy-named.ts
Normal file
11
packages/docs/src/helpers/lazy-named.ts
Normal file
@@ -0,0 +1,11 @@
|
||||
import { lazy } from "react"
|
||||
|
||||
export function lazyNamed<
|
||||
Key extends string,
|
||||
Component extends React.ComponentType,
|
||||
>(key: Key, loadModule: () => Promise<Record<Key, Component>>) {
|
||||
return lazy<Component>(async () => {
|
||||
const mod = await loadModule()
|
||||
return { default: mod[key] }
|
||||
})
|
||||
}
|
||||
Reference in New Issue
Block a user