Reactjs 正在传递路由,但未渲染组件
我的问题是关于这条线的第一条路线:Reactjs 正在传递路由,但未渲染组件,reactjs,react-router,Reactjs,React Router,我的问题是关于这条线的第一条路线: <Route path="/products/:id" Component={ProductDetails} /> 您正在通过组件道具将组件传递到路由,但它应该是组件 <Route path="/products/:id" component={ProductDetails} /> oh lol谢谢,是的component@UnskilledCoder哈哈,这是常有的事。不客气。 impor
<Route path="/products/:id" Component={ProductDetails} />
您正在通过
组件
道具将组件传递到路由
,但它应该是组件
<Route path="/products/:id" component={ProductDetails} />
oh lol谢谢,是的component@UnskilledCoder哈哈,这是常有的事。不客气。
import React, { Component } from "react";
class ProductDetails extends Component {
handleSave = () => {
// Navigate to /products
};
render() {
return (
<div>
<h1>Product Details - </h1>
<button onClick={this.handleSave}>Save</button>
</div>
);
}
}
export default ProductDetails;
<Route path="/products/:id" component={ProductDetails} />