我在 html 串列項中有以下鏈接,但出現錯誤。
<li className="nav-item">
<Link to={'/cart'}>
<i
className="fa fa-shopping-bag"
style={{fontSize: "22px"}}></i>
</Link>
</li>
錯誤:
index.tsx:19 Uncaught Error: useHref() may be used only in the context of a <Router> component.
uj5u.com熱心網友回復:
因為在樹上的某個地方,您沒有將組件包裝在路由器組件中,這是使反應路由器作業所必需的。
請參閱:https : //v5.reactrouter.com/web/guides/quick-start/1st-example-basic-routing
轉載請註明出處,本文鏈接:https://www.uj5u.com/caozuo/397220.html
