1.0.3 ā€¢ Published 3 years ago

react-drupal-json-api v1.0.3

Weekly downloads
-
License
ISC
Repository
github
Last release
3 years ago

Welcome to react-drupal-json-api šŸ‘‹

Version License: ISC Twitter: brockbalducci

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

KeyDescriptionRequired
baseURLThe address of your decoupled Drupal instance.Yes
collectionThe collection name of the resources you would like to request. (article, post, person, etc.)Yes
includeThe names of the relationship fields you would like to include.No
sortThe 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

šŸ‘¤ Brock Balducci


Show your support

Give a ā­ļø if this project helped you!