Skip to content

effector/no-forward โ€‹

Any forward call could be replaced with sample call.

ts
// ๐Ÿ‘Ž could be replaced
forward({ from: trigger, to: reaction })

// ๐Ÿ‘ makes sense
sample({ clock: trigger, target: reaction })

Nice bonus: sample is extendable. You can add transformation by fn and filtering by filter.

ts
// ๐Ÿ‘Ž could be replaced
forward({ from: trigger.map((value) => value.length), to: reaction })

// ๐Ÿ‘ makes sense
sample({ clock: trigger, fn: (value) => value.length, target: reaction })

Last updated:

Released under the MIT License