@@ -18,7 +18,7 @@ scopes. The usual pattern is:
|
|||||||
`effect-fc` re-exports the `Lens` and `Subscribable` modules from
|
`effect-fc` re-exports the `Lens` and `Subscribable` modules from
|
||||||
[`effect-lens`](https://github.com/Thiladev/effect-lens) for convenience. The
|
[`effect-lens`](https://github.com/Thiladev/effect-lens) for convenience. The
|
||||||
core data model and transformation APIs belong to `effect-lens`, so check the
|
core data model and transformation APIs belong to `effect-lens`, so check the
|
||||||
`effect-lens` documentation for the full Lens/Subscribable API.
|
[`effect-lens` documentation](https://github.com/Thiladev/effect-lens/tree/master/packages/effect-lens) for the full Lens/Subscribable API.
|
||||||
|
|
||||||
## Where To Store State
|
## Where To Store State
|
||||||
|
|
||||||
@@ -124,11 +124,11 @@ const CounterControlsView = Component.make("CounterControls")(
|
|||||||
|
|
||||||
const increment = yield* Component.useCallbackSync(
|
const increment = yield* Component.useCallbackSync(
|
||||||
() => Lens.update(state.count, (n) => n + 1),
|
() => Lens.update(state.count, (n) => n + 1),
|
||||||
[state.count],
|
[],
|
||||||
)
|
)
|
||||||
const reset = yield* Component.useCallbackSync(
|
const reset = yield* Component.useCallbackSync(
|
||||||
() => Lens.set(state.count, 0),
|
() => Lens.set(state.count, 0),
|
||||||
[state.count],
|
[],
|
||||||
)
|
)
|
||||||
|
|
||||||
return (
|
return (
|
||||||
@@ -239,4 +239,4 @@ Updating the focused `name` Lens through `Lens.useState` updates the parent
|
|||||||
|
|
||||||
For focusing into nested state, deriving lenses, custom write behavior, and the
|
For focusing into nested state, deriving lenses, custom write behavior, and the
|
||||||
complete API, refer to the
|
complete API, refer to the
|
||||||
[`effect-lens` documentation](https://github.com/Thiladev/effect-lens).
|
[`effect-lens` documentation](https://github.com/Thiladev/effect-lens/tree/master/packages/effect-lens).
|
||||||
|
|||||||
Reference in New Issue
Block a user