content/docs/07-reference/03-ai-sdk-rsc/08-use-ai-state.mdx
useAIStateIt is a hook that enables you to read and update the AI state. The AI state is shared globally between all useAIState hooks under the same <AI/> provider.
The AI state is intended to contain context and information shared with the AI model, such as system messages, function responses, and other relevant data.
<Snippet text={import { useAIState } from "@ai-sdk/rsc"} prompt={false} />
Similar to useState, it is an array where the first element is the current AI state and the second element is a function to update the state.