Scope
Scope is a fully isolated instance of application.
The primary purpose of scope includes SSR (but is not limited to). Scope contain independent clone of all the units (including connections between them) and basic methods to access them.
Scope can be created by fork
Imperative effects calls with scope#
Imperative effects calls are supported in effect handlers but not in watch functions.
When effect call another effects then it should call only effects, not common async functions and effect calls should have await:
Correct, effect without inner effects:
Correct, effect with inner effects:
Incorrect, effect with inner effects:
So, any effect might either call another effects or perform some async computations but not both.
tip
Consider using attach instead of imperative call
Scope methods#
getState#
Returns store value in given scope
Example#
Create two instances of application, call events in them and test $counter store value in both