@multisynq/react
Version:
React bindings for Multisynq
33 lines (32 loc) • 1.24 kB
TypeScript
import { MultisynqReactSessionParameters } from '../createMultisynqSession';
import { ReactModel } from '../ReactModel';
interface InMultisynqSessionProps<M extends ReactModel> extends Omit<MultisynqReactSessionParameters<M>, 'name' | 'password'> {
name: string;
password: string;
children: React.ReactNode | React.ReactNode[];
}
/** Main wrapper component that starts and manages a Multisynq session, enabling child elements to use the
* {@link usePublish}, {@link useSubscribe}, {@link useObservable}, {@link useViewId} and {@link useModelRoot} hooks.
*
* Takes the same parameters as {@link Session.join} except that it doesn't need a root View class,
* since multisynq-react provides a suitable View class behind the scenes.
*
* ```
* function MyApp() {
* return (
* <InMultisynqSession
* apiKey='1_123abc',
* appId='com.example.myapp'
* name='mySession'
* password='secret'
* model={MyRootModel}
* ...
* >
* // child elements that use hooks go here...
* </InMultisynqSession>
* )
* }
* ```
*/
export declare function InMultisynqSession<M extends ReactModel>(params: InMultisynqSessionProps<M>): JSX.Element | null;
export {};