Skip to content
CCPEDIAby Unity Nodes
Discussions/App Development/Does @daml/react work with interfaces?Forum ↗

Does @daml/react work with interfaces?

App Development2 posts139 views2 likesLast activity Feb 2024
JV
jvelasco.intellecteuOP
Feb 2024

Hi,

I was wondering if it is possible to query an interface from the generated @daml/react.

Best
Jose Velasco

ST
Stephen
Feb 2024

Yes. If you take a look at the documentation for the synchronous useQuery, and asynchronous useStreamQueries, you’ll note they accept a TemplateOrInterface argument rather than the prior Template argument. If your @daml/react is new enough to have this signature, its accompanying TypeScript codegen should also generate values representing your interfaces to be passed in as the argument here. (edit: your codegen version and @daml/react version should be kept in sync.)

Note that as with the underlying JSON API streaming queries only allow one interface ID at a time, so not all useStreamQueries calls you might imagine will work.

← Back to Discussions