@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.