diff --git a/packages/docs/docs/state-management.md b/packages/docs/docs/state-management.md index bcb0c49..1806b47 100644 --- a/packages/docs/docs/state-management.md +++ b/packages/docs/docs/state-management.md @@ -9,9 +9,11 @@ title: State Management scopes. The usual pattern is: 1. Create state with Effect primitives such as `SubscriptionRef`. -2. Expose read-only reactive state as a `Subscribable`. -3. Expose read/write reactive state as a `Lens`. -4. Bind values into components with `Subscribable.useAll`. +2. Turn the Effect primitive into a `Lens` with the matching constructor, such + as `Lens.fromSubscriptionRef`. +3. Expose read-only reactive state as a `Subscribable`. +4. Expose read/write reactive state as a `Lens`. +5. Bind values into components with `Subscribable.useAll`. `effect-fc` re-exports the `Lens` and `Subscribable` modules from [`effect-lens`](https://github.com/Thiladev/effect-lens) for convenience. The @@ -102,9 +104,7 @@ const CounterReadOnlyView = Component.make("CounterReadOnly")( ) ``` -Use `Subscribable.useAll` instead of subscribing manually. It reads the current -values during render and uses scoped subscriptions to update React state when -changes arrive. +`Subscribable.useAll` reads the current values during render and uses scoped subscriptions to update React state when changes arrive. ## Lenses