Allows to fetch data using drupal client on component level. Easy to use, easy to include in your project.
- Copy hooks folder and place it into the root of the react.
- That all.
import { useDrupalCollection } from "../../hooks/useDrupalCollection";
export function Component() {
const { response, error, loading } = useDrupalCollection(
"entity_type--entity_bundle",
);
return ();
}
import { useDrupalResource } from "../../hooks/useDrupalResource";
export function Component() {
const { response, error, loading } = useDrupalResource(
"entity_type--entity_bundle",
"entity_uuid"
);
return ();
}