How to FetchByKey from React?

Hi,

Please help with the right way to fetch this contract by its key.

template MyTemplate
  with 
    party1: Party
    productId: Text
    comment: Text 
  where 
    signatory party1
    key (party1, productId):(Party, Text)
    maintainer key._1

Many thanks. @palanisamyc @alex.graham

This works. Thank you @alex.graham

const key = { _1: "MyParty", _2: "MyString" };
const {contract, loading} = useFetchByKey(MyTemplate, () => key, []);
1 Like