React-moralis function useMoralisQuery, searching item by dynamic variable wont work

Iā€™m trying to query patientā€™s consultation data via currentPatientWalletId which is a variable am passing to the useMoralisQuery hook,butit cant.bt once i hard code the currentPatientWalletId it works.please help.

import React,{useEffect,useState} from 'react';
import { useMoralis, useMoralisQuery } from 'react-moralis';
function PatientConsultationReport({currentPatientWalletId}) {
    const { isAuthenticated,Moralis,user,isWeb3Enabled,authenticate,enableWeb3 } = useMoralis();
    const { fetch,data,isLoading,error } = useMoralisQuery(
        "consultation",(query) => query.equalTo(
        "patientWalletId",currentPatientWalletId),[],{live:true} );     
return (
    <div>
        <div>PatientConsultationReport</div> <hr />        
         {
                    error ? (<span>šŸ¤Æ</span>):
                    isLoading ? ( <span>šŸ™„</span>):
                      
                      (<pre>{JSON.stringify(data, null, 2)}</pre>)
                }
    </div>
  )
}

export default PatientConsultationReport

The useMoralisQuery hook got dependencies to which you can add some parameters to it.

Hereā€™s a little fix to the query

const { fetch, data, isLoading, error } = useMoralisQuery(
  "consultation",
  (query) => query.equalTo("patientWalletId", currentPatientWalletId),
  [currentPatientWalletId],
  { live: true }
);

thanksā€¦for your response. I found out that after fetching currentPatientWalletId from the _user class(collection) it is in lower case and ā€œpatientWalletIdā€ is in uppercase hence the query was missbehaving

Hi
I have dashboard in moralis
My table name is NFTTab
in this table I have 4 eventsā€™ variable (x,y, price, new_country)
How could I use useMoralis Query?
for example I would like to see all records in page
sincerely

You can check out the docs on how to use queries / useMoralisQuery for fetching data.