I am trying to use my custom component but its not appearing. What I am doing wrong?
Custom Component code:
import React, { Component } from 'react'
export class cardComp extends Component {
render() {
return (
<div>
<h1>My Custom Component</h1>
</div>
)
}
}
export default cardComp
and the class where I am trying to use it
import React from 'react'
import { cardComp } from 'src/components/cardComp'
const Daily = () => {
// console.log(kpiData)
return (
<>
<div><cardComp /></div>
</>
)
}
export default Daily
Also, it says cardComp is declared but never used.
>Solution :
I am not sure why you added a bracket.
Please remove that and try like this
import cardComp from 'src/components/cardComp';
Also, I would like to suggest first letter is better capitalized for the component.
For instance CardComp instead of cardComp.
Hope this is helpful to you.