0
I’m having trouble sending a function from one component to another.
The function:
const plus = () => {
setQuantity(quantity + 1);
}
Send as a prop in the "Cart"
<Cart chosen={productDataObj} allchosen={chosenProducts} quantity={quantity} plus={plus}/>
I check which type of variable "plus" is returning within that component and it returns as an object
Initial excerpt from Cart.js
import React from 'react';
import ProductCard from './ProductCard';
export default function Cart(chosen, plus){
const allChosen = chosen.allchosen;
console.log(typeof(plus))
In another component, at the same level of Cart, where I pass another function, it arrives correctly.
Thanks in advance!
I tried so but the return is equal :(
– Antonio Junior