JSFiddle - React, Tailwind, and code Playground

JavaScript

// Get a phrase by its id
const getPhrase = async (id, options = {}) => {
  return initApi().then((api) => {
    return api.query([Prismic.Predicates.at('document.id', id)], {
      ...options,
    });
  });
};