A package of React.js hook(s) to easily fetch data from a headless Drupal instance using the Drupal JSON API module.
npm install react-drupal-json-api
yarn add react-drupal-json-api
import { useDrupalJSONAPI } from "react-drupal-json-api";
let articlesData = await useDrupalJSONAPI({
baseURL: "www.example.com",
collection: "article",
include: ["field_image", "uid"],
sort: "title",
});
Key | Description | Required |
---|---|---|
baseURL | The address of your decoupled Drupal instance. | Yes |
collection | The collection name of the resources you would like to request. (article, post, person, etc.) | Yes |
include | The names of the relationship fields you would like to include. | No |
sort | The field (and direction) you would like your data sorted by. (i.e. "title" would sort alphabetically by title while "-created" would sort reversely by date of creation) | No |
Please report all bugs, issues, and feature requests here.
👤 Brock Balducci
- Website: github.com/devbrock
- Twitter: @brockbalducci
- Github: @devbrock
Give a ⭐️ if this project helped you!