Skip to content

Function: usePlasmaFile()

usePlasmaFile(ref): FileHandle | null

Defined in: react/src/use-plasma-file.ts:60

Resolve a FileRef (or the BrokenFileRef sentinel that ffc §N.11 decodes bad manifests into) to a rendered FileHandle. Returns null when ref === null so a caller can render nothing without a wrapping conditional.

The blob URL is revoked in the cleanup callback — that is what makes chaining usePlasmaFile under StrictMode double-invoke safe. Callers that stream a FileRef in from a live query see it reused as long as the query returns the same object reference; if the parent re-allocates the manifest on every render, wrap the source select in a memo so this effect does not thrash.

FileRef | BrokenFileRef | null | undefined

FileHandle | null