OptionalconfigOne or more SanityConfig objects providing a project ID and dataset name.
Optional when SanityApp is rendered inside an SDKStudioContext provider
(e.g. inside Sanity Studio) — the config is derived from the workspace
automatically.
OptionalinferSet 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