effect
当你需要该包提供的这项行为能力时使用此函数。
<T>(fn: (value: T, previous: T | undefined) => EffectCleanup, options?: EffectBehaviorOptions) => IoBehavior<T>| Name | Type |
|---|---|
| fn | (value: T, previous: T | undefined) => EffectCleanup |
| options | EffectBehaviorOptions |
IoBehavior<T>
import { effect } from '@iostore/store/behavior';
const result = effect(/* ...args */);console.log(result);- 调用前请确认参数类型与可空性约束。
- 注意导入路径与运行环境(服务端/客户端)是否匹配。
相关 API
Section titled “相关 API”packages/io/src/lib/extensions/behaviors/effect.ts