mirror of
https://github.com/hanzoai/next.js.git
synced 2026-09-24 17:00:51 +00:00
17 lines
386 B
TypeScript
17 lines
386 B
TypeScript
// x-ref: https://github.com/vercel/next.js/issues/71840
|
|
|
|
import { ElementType } from 'react'
|
|
|
|
async function getImport(
|
|
slug: string,
|
|
exportName: string
|
|
): Promise<ElementType> {
|
|
const moduleExports = await import(`./${slug}`)
|
|
return moduleExports[exportName]
|
|
}
|
|
|
|
export default async function Home() {
|
|
const Button = await getImport('button', 'Button')
|
|
return <Button />
|
|
}
|