# New useCreateDocument hook and auth error recovery

**Version:** v2.15.0

**Published:** June 24, 2026

This release adds a new React hook for creating documents and fixes an issue where the auth error screen would not automatically recover after a session was restored.

## Create documents with `useCreateDocument`

The new `useCreateDocument` hook gives you a way to create documents directly from your Sanity SDK app. Call the hook to get a create function, then invoke it with a document handle and optional initial content.

**index.ts**

```
import { useCreateDocument, createDocumentHandle } from '@sanity/sdk-react'
function CreateArticleButton() {  
  const createDocument = useCreateDocument()   
  const handleClick = () => {  
    const handle = createDocumentHandle({
      documentId: crypto.randomUUID(),  
      documentType: 'article',  
    })  
    createDocument(handle, { title: 'Untitled' })  
  }
  
  return <button onClick={handleClick}>New article</button> 
}
```

Additional options are available in the [reference documentation](https://reference.sanity.io/_sanity/sdk-react/exports/useCreateDocument/).

### 🐛 Notable bugfixes and improvements

- The auth error screen now automatically recovers when a session is restored, so users no longer need to manually reload after re-authenticating.

