@usecloudstate/react-core
TypeScript icon, indicating that this package has built-in type declarations

2.0.2 • Public • Published

@usecloudstate/react-core

This is the core package for a React application on usecloudstate.io.

Installation

You can install the package with:

npm install @usecloudstate/react-core

Usage

Initiate CloudStateClient

We recommend you create a cloudState instance in a separate file and import it in your application.

// src/cloudState.js
import { CloudStateClient } from '@usecloudstate/react-core';

export const cloudState = new CloudStateClient("<YOUR APP ID>", {
  onAuthSuccess: () => {
    // for example, redirect to a dashboard
    history.location.replace('/dashboard');
  },
  onAuthRequest: () => {
    // for example, redirect to a login page
    history.location.replace('/login');
  },
});

Contributing

Pull requests are welcome. For major changes, please open an issue first to discuss what you would like to change.

Please make sure to update tests as appropriate.

License

MIT

/@usecloudstate/react-core/

    Package Sidebar

    Install

    npm i @usecloudstate/react-core

    Weekly Downloads

    14

    Version

    2.0.2

    License

    MIT

    Unpacked Size

    43.3 kB

    Total Files

    31

    Last publish

    Collaborators

    • ncthis