A Beginner Guide to Compose Locals!
HTML-код
- Опубликовано: 19 окт 2024
- In this video, we will see in-depth how you can use an excellent feature of compose to allow us to share some objects within the compose tree to achieve many behaviors; we will see a practical case in this video and how to use it in general, so Enjoy!
🚀 Online course - Refactoring Legacy Code - bit.ly/47dzTLT
👾 FREE Interview Question PDF - bit.ly/Android...
💻 Android Code Review Checklist - bit.ly/android...
✅ FREE Notion Compose Checklist - sendfox.com/lp...
💚 Join my newsletter - bit.ly/YCNewsl...
👨🏽🏭 Who I am:
I'm Younes Charfaoui, a Software Engineer and an Android Developer. I make videos about Android development, Technology, and productivity for software engineers.
😋 Be My Friend:
💻 GitHub - github.com/You...
🐦 Twitter - / charfaouiyounes
📑 Medium - / mxcsyounes
📷 Instagram - / charfaoui.younes
🌍 My website - www.youneschar...
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.