react-together
Version: 
A library to seamlessly add real-time multi-user interaction to your React app!
17 lines (15 loc) • 614 B
TypeScript
import { NotUndefined } from 'object-hash';
import { Dispatch, SetStateAction } from 'react';
interface ValueMap<T> {
    [userId: string]: T;
}
export interface UseStateTogetherWithPerUserValuesOptions {
    resetOnDisconnect?: boolean;
    resetOnConnect?: boolean;
    keepValues?: boolean;
    overwriteSessionValue?: boolean;
    omitMyValue?: boolean;
    throttleDelay?: number;
}
export default function useStateTogetherWithPerUserValues<T extends NotUndefined>(rtKey: string, initialValue: T, options?: UseStateTogetherWithPerUserValuesOptions): [T, Dispatch<SetStateAction<T>>, ValueMap<T>];
export {};