Skip to content
CCPEDIAby Unity Nodes
App Development

How to FetchByKey from React?

2 posts493 views1 likesLast activity Mar 2021

  1. ManishGroverOP

    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

  2. ManishGrover 1

    This works. Thank you @alex.graham

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