State Hoisting
Lift state up for reusable composables.
What Is State Hoisting?
State hoisting means moving state up out of a composable to its caller. The composable becomes stateless: it just receives a value and reports changes.
Stateful vs Stateless
A stateful composable owns its state with remember. A stateless one holds no state; it takes the value as a parameter and exposes an event. Stateless composables are easier to reuse and test.