A promise that resolves to the stored value.
import { useRealtimeStore } from "@videosdk.live/react-sdk";
const key = "BLOCKED_STUDENTS";
const { getValue } = useRealtimeStore(key);
async function handleGetValue() {
try {
const value = await getValue();
console.log("Fetched value:", value);
} catch (error) {
console.error("Error while getting value:", error);
}
}
handleGetValue();
This method can be used to store or update a value in the Realtime Store.
If the specified key already exists, its value is overwritten. Passing null as the value deletes the key from the store.
The value to store. Pass null to delete the key.
Throws an error if:
import { useRealtimeStore } from "@videosdk.live/react-sdk";
const key = "BLOCKED_STUDENTS";
const { setValue } = useRealtimeStore(key);
async function handleSetValue() {
try {
await setValue("[abcd, efgh]");
console.log("Value updated successfully");
} catch (error) {
console.error("Error while setting value:", error);
}
}
handleSetValue();
Participant ID of the user who updated the value.
The latest value stored for the key.
useRealtimeStoreprovides reactive APIs to store, retrieve, and listen to shared key-value data in real time across all meeting participants.