What is observed?
Reactive props are always observed, even if they are used outside of the render.
Why is it bad?
This leads to extra renders when the value changes, which can be problematic for performance if the render is costly or happening many times.
Solution?
When the value of a props is used outside of rendering, it should not be observed and its change should not trigger a re-render.
What is observed? Reactive props are always observed, even if they are used outside of the render.
Why is it bad? This leads to extra renders when the value changes, which can be problematic for performance if the render is costly or happening many times.
Solution? When the value of a props is used outside of rendering, it should not be observed and its change should not trigger a re-render.
Example playground
Prints:
1
, then2
Expected: only1