@cobaltio/react-cobalt-js
TypeScript icon, indicating that this package has built-in type declarations

1.0.0-beta.18 • Public • Published

react-cobalt-js

Cobalt frontend SDK

NPM JavaScript Style Guide

Install

npm install --save @cobaltio/cobalt-js @cobaltio/react-cobalt-js

Usage

// import Provider & Config components
import { Provider, Config } from "@cobaltio/react-cobalt-js";

// Config component needs to be wrapped inside the Provider component.
// And pass the Cobalt session token (that you generated using the Cobalt backend SDK) to the provider.
<Provider sessionToken={ cobaltToken }>
    {
        // ideally you'd render the Config component inside a modal.
        // the component only gets rendered when `slug` is passed.
        <Config
            id="SOME_UNIQUE_CONFIG_ID" // Optional
            slug="APP_SLUG" // application type / slug
            // dynamic labels payload (optional)
            labels={{ /* PAYLOAD */ }}
            // you can override the component's container style if you want
            style={{
                borderRadius: 8,
                maxWidth: 450,
            }}
        />
    }
</Provider>

Example

For an example implementation, you can check out the App.js file in the example directory.

Readme

Keywords

none

Package Sidebar

Install

npm i @cobaltio/react-cobalt-js

Weekly Downloads

8

Version

1.0.0-beta.18

License

MIT

Unpacked Size

158 kB

Total Files

6

Last publish

Collaborators

  • subrat.1108
  • gocobalt