How to query custom type and filter by relationship with @prismicio/react

Hello there!
Im trying to create a slice that display a filter grid, in which my custom type (book) need to be filtered by Author (Custom Type) and by Category (Custom type).

I set up my books so they can have a relationship with author and category.
so its set up as follows: "A book can have one or multiple authors and one or multiple categories".

Since im developing everything inside a slice (in order to be accessible throughout the site), im using @prismic/react usePrismicDocumentsByType(documentType, params).

and in that way I can get all results and filter them out with javascript, but I was wondering if there's a way that I can fetch with that same hook pre-filtered data, I mean get them by type and author in one call.

Thank u!

Hello Leslie,

Welcome to the Prism ic community, and thanks for reaching out to us.

I believe what you want to achieve we have already discussed in the following threads:

Here are some documents in React.js and technical reference:

  1. Pull in data from another document
  2. Rest API technical reference.
  3. GraphQuery API option.

Let me know if you have any further questions.