Skip to content

Getting Started

Installation

Terminal window
npm install @wpappointments/data

Basic Usage

import { useBookableEntities } from '@wpappointments/data';
export function CourtsList() {
const { entities, isLoading, error } = useBookableEntities('court');
if (isLoading) return <p>Loading...</p>;
if (error) return <p>Error: {error.message}</p>;
return (
<ul>
{entities.map((court) => (
<li key={court.id}>{court.title}</li>
))}
</ul>
);
}

Peer Dependencies

The data package expects WordPress packages to be available:

  • @wordpress/api-fetch
  • @wordpress/data
  • react