Interlude: Reactivity and Functions (leptos-rs.github.io)
The post highlights the importance of closures in achieving reactivity. They enable the framework to rerun the smallest possible unit of your application in response to a change. Consequently, two key points to remember are:
Your component function is a setup function, not a render function, and it runs only once.
For values in your view template to be reactive, they must be functions: either signals (which implement the Fn traits) or closures1.