@hopin.com/integrations-sdk-react
TypeScript icon, indicating that this package has built-in type declarations

0.3.6 • Public • Published

Hopin Integrations SDK React

Build apps on Hopin. Grow your business.

This package is intended as a complement to the Hopin Integrations SDK. It exports some minimal React hooks that make integrating with the SDK easier from an App.

Minimal Example / Quick Start

const SomeComponent = () => {
  const sdk = useHopinSdk();
  const muted = useReactiveItem(sdk?.media.isMuted);

  const toggleMute = useCallback(
    () => sdk?.media.toggleMute(),
    [sdk]
  );

  return (
    <button onClick={toggleMute}>
      { muted ? 'Unmute me' : 'Mute me' }
    </button>
  )
};

useHopinSdk

Wraps the SDK in a hook, handling the lifecycle of the underlying connection for you and returning a (undefined until connected) instance of the SDK.

useReactiveItem

Gives simple access to values that the SDK exposes to your app, triggering re-renders in your component when the value changes.

Readme

Keywords

none

Package Sidebar

Install

npm i @hopin.com/integrations-sdk-react

Weekly Downloads

1

Version

0.3.6

License

UNLICENSED

Unpacked Size

11.1 kB

Total Files

21

Last publish

Collaborators

  • hopin-infra
  • hdong
  • cdun-hopin
  • csilk