Why can't the compiler read addMore imported from '../addMore/addMore'?
P粉463824410
2023-08-17 15:20:19
<p>I want to add a component 'addMore', but the compiler doesn't recognize it. What did I miss? please help. </p>
<p><br /></p>
<pre class="brush:js;toolbar:false;">import React from 'react'
import { MdDeleteForever } from 'react-icons/md'
import addMore from '../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>
)
}</pre>
<p><br /></p>
<p><br /></p>
<pre class="brush:js;toolbar:false;">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>
)
}</pre>
<p><br /></p>
Component names must start with
uppercase letters
. Rename the file nameaddMore.jsx
toAddMore.jsx
and also change the import path. To view this information please visit React.dev Functional Components