how does compose handles conditional remember call...
# compose
k
how does compose handles conditional remember calls? React has its rules of hooks, where each hook cannot be called conditionally (applying similar positional memoization as compose), so I’m curious if something similar applies here
s
no such rules, compose compiler creates groups inside the function body whenever composable might be called conditionally in react terms it is similar to introducing synthetic "components" that wrap conditional parts
s
Does "no such rules" here mean that compose just does not try to do anything like that? If a
remember
is destroyed due to the condition wrapping it being false, does it simply completely disappear as if it never was called before?
s
If you mean flipping
condition
in cases like:
Copy code
if (condition) {
  remember { x }
}
the memoized value will be deleted from the slot table if the branch is not taken during composition.
s
Okay yeah, that's what I assumed 👍
k
Thanks for this, this is pretty awesome