NuxtN
Nuxt17mo ago
6 replies
cosbgn

How would you store a ref of an external packages in a state (useState)

I have this:

import { useChat } from '@ai-sdk/vue';
const { messages, handleSubmit } = useChat()

handleSubmit is a method and messages is a ref().

How can I wrap this in useState to be able to call handleSubmit and access messages from any component and keep the state alive on route change?
Was this page helpful?