---
title: "Discussion on \"If/Else in Compose Is Not View.GONE: Where Your State Goes When a Branch Flips\" | Hashnode"
description: "Discussion on \"If/Else in Compose Is Not View.GONE: Where Your State Goes When a Branch Flips\". Why Jetpack Compose destroys remember state when an if/else branch flips, why AnimatedVisibility won't preserve it, and five production-ready fixes."
url: "https://hashnode.com/posts/if-else-in-compose-is-not-view-gone-where-your-state-goes-when-a-branch-flips/6ae72f6615fed1c2daabaf6e"
---

[Feed](https://hashnode.com/feed) /

Discussion

# [If/Else in Compose Is Not View.GONE: Where Your State Goes When a Branch Flips](https://android-expert.hashnode.dev/if-else-in-compose-is-not-view-gone-where-your-state-goes-when-a-branch-flips?utm_source=hashnode&utm_medium=feed)

Why Jetpack Compose destroys remember state when an if/else branch flips, why AnimatedVisibility won't preserve it, and five production-ready fixes.

Nov 1 · 10 min read · android-expert.hashnode.dev  
Updated Nov 2  
Read the article

-   [#jetpack-compose](https://hashnode.com/tag/jetpack-compose)
-   [#compose-state-management](https://hashnode.com/tag/compose-state-management)
-   [#remember](https://hashnode.com/tag/remember)
-   [#compose-recomposition](https://hashnode.com/tag/compose-recomposition)
-   [#android-architecture](https://hashnode.com/tag/android-architecture)

## Written by

[Android Expert](https://hashnode.com/@android-expert)

@android-expert · Chennai, India

  
[View profile](https://hashnode.com/@android-expert)

Android Expert· Kotlin, Jetpack Compose & production pitfalls

Android Engineer &amp; Kotlin Advocate. 🚀 Deep dives into Jetpack Compose, Coroutines, and Clean Architecture. Turning complex code into scalable solutions. 🛠️✨

## Responses

Markdown supported · ⌘↵ to post

No responses yet.
