Safe hook to access the file cache context. Returns null if not inside a FileCacheProvider instead of throwing.
The file cache context value or null if not available
function MyFileComponent() { const fileCache = useFileCacheSafe(); if (!fileCache) { // Render without cache functionality return <div>File cache not available</div>; } // Use file operations...} Copy
function MyFileComponent() { const fileCache = useFileCacheSafe(); if (!fileCache) { // Render without cache functionality return <div>File cache not available</div>; } // Use file operations...}
Safe hook to access the file cache context. Returns null if not inside a FileCacheProvider instead of throwing.