Skip to content

A package of React.js hook(s) to easily fetch data from a headless Drupal instance using the Drupal JSON API module.

Notifications You must be signed in to change notification settings

devbrock/react-drupal-json-api

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

7 Commits
 
 
 
 
 
 

Repository files navigation

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

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

👤 Brock Balducci


Show your support

Give a ⭐️ if this project helped you!

About

A package of React.js hook(s) to easily fetch data from a headless Drupal instance using the Drupal JSON API module.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published