TGViewer
Android Mobile | YeaHub Android Mobile | YeaHub @yeahub_android_mobile · 431 subscribers
Post #240 147
#полезное
🏠 Compose Preview c MVI и State Hositing

Идея крайне проста:
🟠 В Composable экран передаем state в качестве параметра
🟠 Вторым параметром идет EventManager
🟠 Получаем чистый UI, без бизнес логики и репозиториев
🟠 В @Preview передается замоканые данные, что так же удобно использовать при тестировании компонентов
🟠 Еще 1 большой плюс - упрощение внедрения скриншот тестирования

@Composable
fun ProfileScreen(
state: ProfileScreenState,
onEvent: (ProfileEvent) -> Unit
) {
// Screen data
}


@Preview
@Composable
private fun ProfileScreenPreview() = ProfileScreenContent(
state = ProfileScreenState(),
onEvent = {}
)


👉Новости 👉База вопросов
  • 🔥 2
More from @yeahub_android_mobile
  1. Oct 9, 2026#podcast #всё 📚 TeachMeSkills IT-школа Это серия выпусков от "TeachMeSkills Школа програм…
  2. Oct 8, 2026#Собес #docker_volumes #persistent_data #storage 🤔 Какова цель томов в Docker? 💬 Кратко:…
  3. Oct 7, 2026#Собес #viewholder #recycling #oncreateviewholder 🤔 Как RecyclerView рендерит элементы? �…
  4. Oct 5, 2026#Собес #service_main_thread #background #anr 🤔 В каком потоке по умолчанию работает Servi…
  5. Oct 2, 2026#tool #графы 📚 Терялся в собственном коде? Встречай Gitvizz, инструмент, который мгновенн…
  6. Oct 1, 2026#Собес #UNIQUE_constraint #database_index #SQL 🤔 Использует ли UNIQUE constraint индексы?…
Threads Profile ViewerView any public Threads profile without an account.Open ThreadLook →Writing with AI? Make it sound human.Metric37 rewrites AI drafts so they read naturally. Free AI detector, 1,500 words free.Try Metric37 →