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 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>PatientConsultationReport</div> <hr />        
                    error ? (<span>🤯</span>):
                    isLoading ? ( <span>🙄</span>):
                      (<pre>{JSON.stringify(data, null, 2)}</pre>)

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(
  (query) => query.equalTo("patientWalletId", 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

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

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