React
@ai-sdk/react
No description provided on npm.
Utilities
ai
react
@ai-sdk/react
Utilities
javascript
npm
frontend
open source
ui
library
Stars
698
Weekly
5.9M
Open issues
9
Bundle
~15 kB
Installation
npm install @ai-sdk/reactCode example
import { useChat } from "@ai-sdk/react";
export function Example() {
const { messages, input, handleInputChange, handleSubmit } = useChat();
return (
<form onSubmit={handleSubmit}>
{messages.map((m) => (
<p key={m.id}>{m.role}: {m.content}</p>
))}
<input value={input} onChange={handleInputChange} />
</form>
);
}Pros & cons
Pros
- Actively maintained by vercel-release-bot
- 5.9M weekly downloads. Battle tested
- First-class TypeScript definitions
- Apache-2.0 licensed
Considerations
- Adds roughly ~15 kB to your bundle
- Needs client-only rendering in SSR frameworks
- Not supported in React Native
- 9 open issues on GitHub