@@ -11,6 +11,11 @@ A Lens is an effectful handle to a piece of state. It can read the current value
|
|||||||
subscribe to changes, and write updates back to the underlying source. A Lens
|
subscribe to changes, and write updates back to the underlying source. A Lens
|
||||||
can point at a whole state object or focus on one nested field inside it.
|
can point at a whole state object or focus on one nested field inside it.
|
||||||
|
|
||||||
|
`effect-view` re-exports the `Lens` and `View` modules from
|
||||||
|
[`effect-lens`](https://github.com/Thiladev/effect-lens) for convenience. The
|
||||||
|
core data model and transformation APIs belong to `effect-lens`, so check the
|
||||||
|
[`effect-lens` documentation](https://github.com/Thiladev/effect-lens/tree/master/packages/effect-lens) for the full Lens/View API.
|
||||||
|
|
||||||
The usual pattern is to create state with Effect primitives such as
|
The usual pattern is to create state with Effect primitives such as
|
||||||
`SubscriptionRef`, turn that primitive into a Lens with a matching constructor
|
`SubscriptionRef`, turn that primitive into a Lens with a matching constructor
|
||||||
such as `Lens.fromSubscriptionRef`, and bind Lens values into components with
|
such as `Lens.fromSubscriptionRef`, and bind Lens values into components with
|
||||||
@@ -18,11 +23,6 @@ such as `Lens.fromSubscriptionRef`, and bind Lens values into components with
|
|||||||
|
|
||||||
`View` is the read-only side of this model. Every Lens is also a View.
|
`View` is the read-only side of this model. Every Lens is also a View.
|
||||||
|
|
||||||
`effect-view` re-exports the `Lens` and `View` modules from
|
|
||||||
[`effect-lens`](https://github.com/Thiladev/effect-lens) for convenience. The
|
|
||||||
core data model and transformation APIs belong to `effect-lens`, so check the
|
|
||||||
[`effect-lens` documentation](https://github.com/Thiladev/effect-lens/tree/master/packages/effect-lens) for the full Lens/View API.
|
|
||||||
|
|
||||||
## Where To Store State
|
## Where To Store State
|
||||||
|
|
||||||
State can live pretty much anywhere as a `Lens` or `View`: in a
|
State can live pretty much anywhere as a `Lens` or `View`: in a
|
||||||
|
|||||||
Reference in New Issue
Block a user