![](/img/trans.png)
[英]React - How do i force child components to re render when parent state component changes?
[英]When get build not Render my child components in Layout But when npm state It works right
布局組件:
return (
<>
<ToastContainer />
<div className='font-IranBold'>
<div className="border-b border-white dark:border-gray-500">
<ul className="flex flex-wrap -mb-px text-sm font-medium text-center text-gray-500 dark:text-gray-400">
<Tab TabsInfo={TabsInfo} SetTabState={SetTabState} TabState={TabState} />
</ul>
</div>
<div>
{children}
</div>
</div>
</>
)
return (
<>
<Layout TabsInfo={TabsInfo} SetTabState={SetTabState} TabState={TabState}>
{
TabState === 1 ? <Contentfa AdminAboutFa={AdminAboutFa} /> : <Contenten AdminAboutEn={AdminAboutEn} />
}
</Layout>
</>
)
當我用 npm start 運行項目時沒有問題,它運行了。 當我構建時,它只顯示組件的名稱:
但:
將需要更多信息來提出解決方案。 特別是你這是什么意思
當我用 npm start 運行項目時沒有問題,它運行了。 當我構建時,它只顯示組件的名稱:
由於代碼僅在npm run start
上執行, npm run build
僅用於捆綁代碼,我們仍然需要啟動應用程序才能在前端看到任何內容。
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.