since
effector 20.11.0
withRegion(unit: Unit<T> | Step, cb: () => void)
#
The method allow to explicitly transfer ownership of all units (including links created with sample, forward, etc...) defined in the callback cb
to unit
. As an implication all the created links will be erased as soon as clearNode
will be called on unit
.
The method based on the idea of region-based memory management (see https://en.wikipedia.org/wiki/Region-based_memory_management for reference)
Arguments
unit
: Unit | Step which will serve as "local area" or "region" owned all the units created within provided callbackcb
cb
: () => void Callback where all the relevant units should be defined