/** * useMemoryStack Hook * Access the MemoryStack client and context from any component */ import { useContext } from 'react'; import { MemoryStackContext, MemoryStackContextValue } from '../context/MemoryStackContext'; import { MemoryStackClient } from '../client'; /** * Hook to access the MemoryStack client and context * * @example * ```tsx * function MyComponent() { * const { client, isOnline, pendingOperations, syncPending } = useMemoryStack(); * * const handleAddMemory = async () => { * if (!client) return; * await client.add("User prefers dark mode"); * }; * * return ( * * Online: {isOnline ? 'Yes' : 'No'} * Pending: {pendingOperations} *