@@ -214,20 +214,20 @@ import { Component } from "effect-fc"
|
|||||||
|
|
||||||
const UserPanelView = Component.make("UserPanel")(
|
const UserPanelView = Component.make("UserPanel")(
|
||||||
function* (props: { readonly userId: string }) {
|
function* (props: { readonly userId: string }) {
|
||||||
const user = yield* Component.useOnChange(
|
const label = yield* Component.useOnChange(
|
||||||
() =>
|
() =>
|
||||||
Effect.gen(function* () {
|
Effect.gen(function* () {
|
||||||
yield* Console.log(`Loading ${props.userId}`)
|
yield* Console.log(`Preparing view for ${props.userId}`)
|
||||||
yield* Effect.addFinalizer(() =>
|
yield* Effect.addFinalizer(() =>
|
||||||
Console.log(`Cleaning up ${props.userId}`),
|
Console.log(`Cleaning up ${props.userId}`),
|
||||||
)
|
)
|
||||||
|
|
||||||
return yield* fetchUser(props.userId)
|
return `Viewing user ${props.userId}`
|
||||||
}),
|
}),
|
||||||
[props.userId],
|
[props.userId],
|
||||||
)
|
)
|
||||||
|
|
||||||
return <p>{user.name}</p>
|
return <p>{label}</p>
|
||||||
},
|
},
|
||||||
)
|
)
|
||||||
```
|
```
|
||||||
|
|||||||
Reference in New Issue
Block a user