In React, that means wrapping your app in a Starbeam context provider (normal reactivity, including resources, don't require a context provider in Starbeam, but services do).
In Preact, importing `@starbeam/preact` does all the work.
The basic idea comes from Ember, which has had services for the better part of a decade.
Any Starbeam renderer that can express a concept of "current app" (via context, for example), can use fully reactive universal services written in Starbeam.
Basically, your app state goes into services, instead of module state.
This design lets you instantiate an app multiple times (for testing or SSR, for example) without needing to mock modules or other weird stuff.
Also lets you sign users out by just resetting your app state.
A resource is a reactive formula with cleanup (a universal hook, basically).
A service is a resource that is instantiated once for your entire app, and cleaned up when the app is unmounted.
Starbeam 0.8 is out:
- Updated Resource API
- Universal Services
- Improved React Renderer
- New Preact Renderer
Docs:
- Demos now use Sandpack
- Code snippets now use Twoslash
Next up:
- Add Preact docs
- Vue renderer
- Plan Starbeam 1.0
My talk on Starbeam at @thejsnation is happening now! The video isn't available yet, but you can poke around at the Starbeam org and docs!
nitter.catsarch.com/starbeamjs/status/1538…
Starbeam is fun and simple reactivity that works in your existing framework.