Interacting with the contract in react

I am new to this topic, I am trying to interact with the contract using react-moralis

const { data, error } = useApiContract({
   abi: abi,
   address: process.env.contractAddress,
   functionName: 'price',
   params: {}
 })

 console.log(data, error)

tried this and other methods and I got

null null

as response

Please advice

I would know how to do it in vanilla js

I remember it worked for me either, using https://www.npmjs.com/package/moralis
but since I am using next.js (probably this is messing something) and moralis no longer works during the build process