👋
Welcome to react-drupal-json-api
A package of React.js hook(s) to easily fetch data from a headless Drupal instance using the Drupal JSON API module.
Install
NPM
npm install react-drupal-json-api
Yarn
yarn add react-drupal-json-api
Usage
import { useDrupalJSONAPI } from "react-drupal-json-api";
let articlesData = await useDrupalJSONAPI({
baseURL: "www.example.com",
collection: "article",
include: ["field_image", "uid"],
sort: "title",
});
Options
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 |
Issues
Please report all bugs, issues, and feature requests here.
Author
- Website: github.com/devbrock
- Twitter: @brockbalducci
- Github: @devbrock
Show your support
Give a