Hi. I followed the instructions (npm i, import the thingy, create state variables, and create the component in my code and I get the following error:
Unhandled Runtime Error
Error: Invalid hook call. Hooks can only be called inside of the body of a function component. This could happen for one of the following reasons:
- You might have mismatching versions of React and the renderer (such as React DOM)
- You might be breaking the Rules of Hooks
- You might have more than one copy of React in the same app
See https://reactjs.org/link/invalid-hook-call for tips about how to debug and fix this problem.
Here is my code:
return (
<button type="button" onClick={toggleFavProduct} className={
btn-heart ${isFavourite ? 'btn-heart--active' : ''}}>
<a>
<img src={profileImg} alt="product" onClick={clickSelectProvider}/>
{age &&
<span className="product__discount">Age: {age}</span>
}
</a>
</div>
<div className="product__description" style={{textAlign: "center"}}>
<h3 className="product__description__standardized">{`${firstName} ${lastName}`}</h3>
<div className={"product__price" + (ratePerHour ? 'product__price--discount' : '')} >
<h4 className="product__description__standardized">${ ratePerHour }</h4>
{
<span><span className="product__description__standardized">{ title }</span></span>
}
</div>
</div>
<Calendar></Calendar>
</div>)
};
Hi. I followed the instructions (npm i, import the thingy, create state variables, and create the component in my code and I get the following error:
Unhandled Runtime Error
Error: Invalid hook call. Hooks can only be called inside of the body of a function component. This could happen for one of the following reasons:
See https://reactjs.org/link/invalid-hook-call for tips about how to debug and fix this problem.
Here is my code:
return (
<button type="button" onClick={toggleFavProduct} className={
btn-heart ${isFavourite ? 'btn-heart--active' : ''}}>};