Returns the currently active DocumentResource for the nearest resource context.
DocumentResource
Resolves in priority order:
resource
<ResourceProvider>
projectId
dataset
SanityInstance
undefined
const resource = useResource()console.log(resource?.projectId, resource?.dataset) Copy
const resource = useResource()console.log(resource?.projectId, resource?.dataset)
Returns the currently active
DocumentResourcefor the nearest resource context.Resolves in priority order:
resourceprop on the nearest<ResourceProvider>projectId/datasetfrom the currentSanityInstanceconfigundefinedwhen neither is available