我们的产品
//文件名-allProducts 从“反应”导入反应
const AllProducts = () => { 返回 ( 所有产品 ) }
导出默认所有产品;
我没有被重定向到此页面,因为输出未显示任何有关如何解决此问题的建议。
我相信您没有获得输出,因为在 React 中,当您尝试返回组件时,它不会自动渲染其内容,除非您将其用作另一个组件渲染部分中的 JSX 元素。
尝试在 return 语句中渲染任何 JSX 代码,而不是组件本身。
// FileName - allProducts.js
import React from 'react';
const AllProducts = () => {
return (
<div>
<h1>All Products</h1>
{/* Add any other JSX content here that you want to print*/}
</div>
);
};
export default AllProducts;