Skip to main content
Requires the entities bundle. A project without the entities bundle returns 403 database/tables-not-available. See Bundles.

Overview

useFetchEntity returns a function that fetches a single entity by its Sublay entity ID. Use this for on-demand fetches outside of EntityProvider.

Usage Example

Parameters

string
required
The Sublay entity ID to fetch.
string | EntityInclude[]
Optional. Populate related fields. Accepted values: "user", "space", "topComments", "saved", "files", "grants".
number
With "topComments" included: how many top comments per entity. Server default 1, maximum 5. Not sent when include doesn’t contain "topComments".
ReactionType
With "topComments" included: the reaction whose raw count ranks the top comments. Server default "upvote". Not sent when include doesn’t contain "topComments".

Returns

Entity
The fetched entity. When spaceReputation is requested, the embedded author carries an added spaceReputation number. See Entity data model and Reputation.