OptionalconfigOptionalinferSet this to automatically fetch and register the organization's media library and canvas as named resources.
These resources will be available to hooks as media-library and canvas.
The SDK App must be running in the organization's Dashboard to use this feature.
const MyApp = () => {
// should "just work" because of inferMediaLibraryAndCanvas.
const {data: assets} = useDocuments({
documentType: 'sanity.asset',
resourceName: 'media-library',
})
return (
<div>
{assets.map((asset) => (
<div key={asset._id}>{asset.originalFilename}</div>
))}
</div>
)
}
<SanityApp inferMediaLibraryAndCanvas>
<MyApp />
</SanityApp>
OptionalresourcesOptionalsanity
One or more SanityConfig objects providing a project ID and dataset name. Optional when
SanityAppis rendered inside anSDKStudioContextprovider (e.g. inside Sanity Studio) — the config is derived from the workspace automatically.