Getting error when I add useState function in productItem.js file.
Code in ProductItem.js
import ‘./ProductItem.css’;
import React, { useState } from ‘react’
function ProductItem(props) {
const [changeText, setText] = useState(props.type)
function clickHandler(){
setText('Added to Cart')
}
return(
{props.name}
{changeText}
{props.price}
Add to Cart
}
export default ProductItem;