DEV Community

Discussion on: Introducing the Marko Tags API Preview

Collapse
 
ryansolid profile image
Ryan Carniato

It does mean that. But it also makes sense. The effect makes something on each run (ie creates the side effect) and then would need to be released. It's symmetrical pair.

In order to get out of that if you create something in the effect and would want to check that it is already created on then next run you'd need to hoist that out. Hoisting that into <let> would make it stateful and cause updates itself which might not be intended.

Picture a subscription for example. You'd presumably need to know if you were already subscribed if it ever ran again. Now if the data doesn't change then you never need to re-run the effect. If it does in a way that would change what you are subscribing to, release and recreate makes sense. If it doesn't well you need to now keep track of that externally.

So if you need something that persists with a reference over multiple updates the <lifecycle> tag is exactly what you are looking for as it has a built in mechanism to preserve its references.

Collapse
 
dephiros profile image
An Nguyen

Thanks for the explanation @ryansolid !