While CompositionLocal can make testing more difficult due to implicit state and dependencies, using techniques like CompositionLocalProvider or manually overriding values during tests can help alleviate some of these challenges. However, for most stateful composables, hoisting state is generally preferred for its testability and transparency.
Per the documentation a CompositionLocal should have a good default value. Avoid CompositionLocal for concepts that aren't thought as tree-scoped or sub-hierarchy scoped. A CompositionLocal makes sense when it can be potentially used by any descendant, not by a few of them. This example is not how it should be used.
Powerful compose feature explained in a super easy-to-understand way, I came here struggling but now I know something more.
While CompositionLocal can make testing more difficult due to implicit state and dependencies, using techniques like CompositionLocalProvider or manually overriding values during tests can help alleviate some of these challenges. However, for most stateful composables, hoisting state is generally preferred for its testability and transparency.
Sir waiting for next one..
I hope that you do a playlist about jetpack compose
Per the documentation a CompositionLocal should have a good default value. Avoid CompositionLocal for concepts that aren't thought as tree-scoped or sub-hierarchy scoped. A CompositionLocal makes sense when it can be potentially used by any descendant, not by a few of them. This example is not how it should be used.
This example is to show how the feature work, but the use cases may differ from one to one.