Error while calling transferFunds method of Solidity to send Eth

I am getting the error
image

React Function :

const {
    Moralis,
    user,
    web3,
    isAuthenticated,
    isWeb3Enabled,
    isWeb3EnableLoading,
  } = useMoralis();

  const transfer = async () => {
    if (!isWeb3Enabled && !isWeb3EnableLoading) await Moralis.enableWeb3();
    const currentUser = user.get("ethAddress");
    let Charity = new web3.eth.Contract(contractABI, contractAddress);

    const id = await Charity.methods
      .transferFunds(proposalID, message)
      .send({
        from: currentUser,
        value: Moralis.Units.ETH(amount),
      })
      .then(() => {
        toast.success(`Successfully Donated ${amount} MATIC!`, toastStyles);
      });
  };

Solidity Function:

function transferFunds(uint256 proposalID, string memory message)
        public
        payable
    {
        if (proposalRegistry[proposalID].proposalExists) {
            bytes32 NGOId = proposalRegistry[proposalID].postOwner;

            if (ngoRegistry[NGOId].ngoExists) {
                address receiver = ngoRegistry[NGOId].wallet_address;

                if (msg.sender != receiver) {
                    payable(receiver).transfer(msg.value);
                    emit Transfer(
                        proposalID,
                        msg.sender,
                        receiver,
                        msg.value,
                        message,
                        block.timestamp
                    );
                    proposalRegistry[proposalID].amt += msg.value;

                    if (proposalReachedThreshold(proposalID)) {
                        proposalRegistry[proposalID].closed = true;
                    }
                }
            }
        }
    }

    function proposalReachedThreshold(uint256 proposalID)
        private
        view
        returns (bool)
    {
        return
            proposalRegistry[proposalID].amt >=
            proposalRegistry[proposalID].amtThreshold;
    }

Can someone tell me the code to send money via the “transferFunds” solidity function through react?

It looks like web3.eth is undefined. Maybe it is ethers now in your case. You can use directly executeFunction or the equivalent in react

I didn’t understand this. Could you point me to some resource

https://docs.moralis.io/moralis-server/web3/web3#executefunction

const contractProcessor = useWeb3ExecuteFunction();

const transfer = async () => {
    if (!isWeb3Enabled) await Moralis.enableWeb3();
    const options = {
      contractAddress: contractAddress,
      functionName: "transferFunds",
      abi: contractABI,
      params: {
        proposalID, message
      }
    };

    await contractProcessor.fetch({
      params: options
    });
  };

I could use this. But I had a doubt. The above solidity code requires me to send value; as in msg.value. What should I add in above code to do that

You were talking about this above code right?

You can send that msg value as parameter too, you can find in documentation how to do it