【发布时间】:2023-03-08 07:40:02
【问题描述】:
感谢您的宝贵时间。我无法让这个链接在反应中工作。我已经使用了 BrowserRouter 并向路由器传递了一个路径和一个组件。但是我仍然得到一个跨源错误和帮助会很棒。这是代码
class Products extends React.Component {
render() {
return (
<div className="container">
<div className="row">
<div className="col-4">
<div className="card">
<img
className="card-img-top"
src="/images/pathToYourImage.png"
alt="Card cap"
/>
<div className="card-body">
<h4 className="card-title">Card title</h4>
<p className="card-text">
Some quick example text to build on the card title and make up
the bulk of the card's content.
</p>
<Link to="/">
<div className="btn btn-primary">
Go somewhere
</div>
</Link>
</div>
</div>
</div>
<div className="col-4">Product Two</div>
<div className="col-4">Product Three</div>
</div>
</div>
);
}
}
export default Products;
【问题讨论】:
-
请发布您遇到的确切错误。