- Oct 2020
I really dont need a solution to this problem! I can find many workararounds
Actually, the answer that was given was a good answer, as it pointed to the problem: It was a reminder that you need to:
assign to a locally declared variable.
So I'm not sure the answer was intended to "just" be a solution/workaround, but to help correct or fill in the misunderstanding / forgotten piece of the puzzle to help OP realize why it wasn't working, and realize how reactivity is designed to work (based on assignments).
It was a very simplified answer, but it was meant to point in the right direction.
Indeed, it pointed to this main point that was explained in more detail by @rixo later:
Personally, this also totally aligns with my expectations because in your function
fruitcan come from anywhere and be anything: