@airstate/use-shared-state
v0.0.4
Published
[BETA] useState but instantly syncs across clients in realtime
Downloads
10
Readme
@airstate/use-shared-state
A drop-in replacement for React's useState for developers who want to build realtime React apps.
useSharedState automatically syncs state across different clients in real-time.
[BETA] This program is still in beta, and is it active development. Refrain from using it in production as the API is as of yet, unstable.
Installation
pnpm install --save @airstate/use-shared-stateConfigure
AirState Cloud
Get your appKey from console.airstate.dev
import { configure } from '@airstate/use-shared-state';
// Call this before your app starts
// (safe to call in SSR outside react tree)
configure({
appKey: '[your app key]',
});Self Hosted
import { configure as configureAirState } from '@airstate/use-shared-state';
// Call this before your app starts
// (safe to call in SSR outside react tree)
configureAirState({
server: 'https://[your-server-hostname]:[port]/airstate',
});Telemetry
By default AirState gathers information about the framework being used only in localhost. This allows us to build better software to help the community.
Note: no identifying information is sent to our servers.
configureAirState({
// ...
disableDevelopmentTelemetry: false, // or `true`
// ...
});License
MIT
