最新消息:雨落星辰是一个专注网站SEO优化、网站SEO诊断、搜索引擎研究、网络营销推广、网站策划运营及站长类的自媒体原创博客

astrojs - Client-only component within `client:load` React component - Stack Overflow

programmeradmin4浏览0评论

Inside *.astro page I have a React component, that has client:load directive. Inside the component I have another component that must be loaded only on client. How can I do it?

// pages/index.astro
import ComplexComponent from '../components/ComplexComponent'
...
<ComplexComponent client:load />
...
// components/ComplexComponent.tsx
...
export default function ComplexComponent() {
  ...
  return (
    <>
      <Component />
      <ClientOnly> // <---- ???
        <BrowserComponent/>
      </ClientOnly>
    </>
  )
}
发布评论

评论列表(0)

  1. 暂无评论