Heim > Fragen und Antworten > Hauptteil
P粉3582815742023-08-18 09:40:32
组件名称必须以大写字母
开头。将文件名addMore.jsx
重命名为AddMore.jsx
,并且还要更改导入路径。查看此信息请访问React.dev功能组件
// ShoppingCardItem.jsx import React from 'react' import { MdDeleteForever } from 'react-icons/md' import AddMorefrom '../AddMore/AddMore' import './ShoppingCardItem.css' export default function ShoppingCardItem() { return ( <div className='shoppingCardItem-Container'> <img src="./img/Apfel.jpg" alt="" /> <p>2x Apfel</p> <AddMore/> <MdDeleteForever /> </div> ) }
// AddMore.jsx import React from 'react' export default function AddMore() { return ( <div className="btn-group"> <button type="button" className="btn btn-primary">+</button> <button type="button" className="btn btn-primary">-</button> </div> ) }