#How would you store a ref of an external packages in a state (useState)
6 messages · Page 1 of 1 (latest)
is it necessary to be useState? As in - do you render it on the server?
Not really, I only want the chat messages / methods etc available across multiple pages/components
Currently I do:
const { chat_messages } = useSharedStore()
onBeforeUnmount(() => {
chat_messages.value = messages
})
onBeforeMount(() => {
messages.value = chat_messages.value
})
But I should do it manually for each item and it's not ideal to keep all duplicated and synced. Ideally I would just have the messages directly in a store
@willow tree
But it's definitely only needed client side if that simplifies things