Skip to content

@lubusin/wp-frappe-data-store / useFrappeResource

Function: useFrappeResource()

useFrappeResource(store, doctype, name): object & RequestStatus

Defined in: src/hooks.ts:22

React hook to subscribe to a single Frappe document by DocType and name. Automatically triggers background fetching via store resolvers if not already cached.

Parameters

store

FrappeDataStore

The registered Frappe @wordpress/data store descriptor.

doctype

string

The Frappe DocType name (e.g., 'Task').

name

string

The unique document identifier.

Returns

object & RequestStatus

Object containing the document resource, isResolving loading state, and any request error.

Released under the MIT License.