npm install @y-sweet/react
npm install @y-sweet/sdk
import { YDocProvider } from '@y-sweet/react'
import { getOrCreateDocAndToken } from '@y-sweet/sdk'
export default async function MyServerComponent() {
const clientToken = await
getOrCreateDocAndToken(YOUR_CONNECTION_STRING, docId)
return (
<YDocProvider
clientToken={clientToken}
setQueryParam="doc"
>
<MyCollaborativeEditor />
</YDocProvider>
)
}
import { useMap } from '@y-sweet/react'
const items = useMap('colorgrid')
items.delete(key)
items.set(key, color)