on
Edit this pageon
is designed to be passed into a computation to make its dependencies explicit.
If an array of dependencies is passed, input
and prevInput
are arrays.
You can also not run the computation immediately and instead opt in for it to only run on change by setting the defer option to true.
on
with stores
Using Info:
Please note that on stores and mutable, adding or removing a property from the parent object will trigger an effect. See
createMutable
Arguments and Options
Argument | Type | Description |
---|---|---|
deps | T | The dependencies to watch. |
fn | (input: T, prevInput: T, prevValue?: U) => U | The function to run when the dependencies change. |
options | { defer?: boolean } | Options to configure the effect. |