JSPM

@launchbase/react

0.1.7
  • ESM via JSPM
  • ES Module Entrypoint
  • Export Map
  • Keywords
  • License
  • Repository URL
  • TypeScript Types
  • README
  • Created
  • Published
  • Downloads 5
  • Score
    100M100P100Q29372F
  • License MIT

The Launchbase SDK for React

Package Exports

  • @launchbase/react

This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (@launchbase/react) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.

Readme

Launchbase's SDK for React.
The SDK is also documented in the Launchbase Docs.

Install

# yarn
yarn add @launchbase/react

# npm
npm install @launchbase/react

Usage

Hook

The useLaunchbase-hook enables you to open and close the launchbase widget. It also provides the isOpen property, which makes the open-state of the widget observable.

import useLaunchbase from '@launchbase/react';

let Component = () => {
  let { open, close, toggle, isOpen } = useLaunchbase({
    integrationKey: '{{integrationKey}}'
  });

  return (
    <div>
      <p>Launchbase is {isOpen ? 'open' : 'closed'}.</p>

      <button onClick={open}>Open Launchbase</button>
      <button onClick={toggle}>Toggle Launchbase</button>
      <button onClick={close}>Close Launchbase</button>
    </div>
  );
};

Button

import { LaunchbaseButton, setup } from '@launchbase/react';

setup({
  integrationKey: '{{integrationKey}}'
});

let Component = () => {
  return (
    <div>
      <LaunchbaseButton
        // You can pass any props you could normally pass to a button
        style={{
          padding: '8px 12px',
          borderRadius: 5,
          color: 'white',
          background: 'black',
          border: 'none'
        }}
      >
        Get Early Access
      </LaunchbaseButton>
    </div>
  );
};

License

MIT © Tobias Herber at Varld