How to run useMoralisWeb3ApiCall Hook conditional?

https://docs.moralis.io/moralis-dapp/web3-sdk/native#runcontractfunction

I build a frontend where you can enter a wallet address and a contract address into input fields.
I then build the options with:

const [StakingContractParams, setStakingContractParams] =
		useState();

and then later in onSubmit:

	const onSubmit = (e) => {
		e.preventDefault();
		if (!inputs.wallet && !inputs.token) {
			alert("Please choose a token");
			return;
		}
		// Set the Params for Staking pool
		setStakingContractParams({
			chain: "bsc",
			address: inputs.wallet,
			functionName: "userInfo",
			abi: AbiUserInfo,
			params: {
				address: "0x71e0B02eA84C79689d246d32a4ca9dEafdb89829",
				uint256: "2",
			},
		});
	};

the call of the code above is in a seperate “componenten” inserted in the main app.

How can i just run this when there is a valid and complete “StakingContractParams”?

Does providing a live: false as a parameter in your useMoralisWeb3ApiCall stop it from running automatically? If so then you just call fetch() as normal.

Otherwise you could use useMoralisWeb3Api() instead.

If you’re trying to use the result in another component, you can try by lifting state. https://reactjs.org/docs/lifting-state-up.html