Hello I am trying to upload files to IPFS using the ethereum boilerplate and Moralis Hooks for NextJS projects.
First I was doing it with :
const response = await Moralis.EvmApi.ipfs.uploadFolder({ abi });
setHashImage(response.result[0].path);
setHashPdf(response.result[1].path);
And it’s working. But I am asking myself if I can achieve the same result with the useEvmUploadFolder() hook.
But when I am doing :
const { data } = useEvmUploadFolder({ abi });
console.log(‘data’, data);
I have the following 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.
What am I doing wrong ? Thanks.