---
title: "Discussion on \"useDebounce in Android's JetPack Compose?\" | Hashnode"
description: "Discussion on \"useDebounce in Android's JetPack Compose?\". Introduction\nSearching is an essential functionality in most commercial mobile apps as it allows users to quickly retrieve their content of interest rather than going through all the provided content which results in a poor user experience.\nImplement..."
url: "https://hashnode.com/posts/usedebounce-in-androids-jetpack-compose/64567eb159cc7abf5cac0448"
---

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

Discussion

# [useDebounce in Android's JetPack Compose?](https://mohammedev.hashnode.dev/usedebounce-in-androids-jetpack-compose?utm_source=hashnode&utm_medium=feed)

Introduction Searching is an essential functionality in most commercial mobile apps as it allows users to quickly retrieve their content of interest rather than going through all the provided content which results in a poor user experience. Implement...

May 6, 2023 · 5 min read · mohammedev.hashnode.dev  
Read the article

-   [#android](https://hashnode.com/tag/android)
-   [#jetpack-compose](https://hashnode.com/tag/jetpack-compose)
-   [#reactjs](https://hashnode.com/tag/reactjs)
-   [#developer](https://hashnode.com/tag/developer)

## Written by

[Mohamed Dhyia Eddine](https://hashnode.com/@MohammedDhiya)

@MohammedDhiya · Algeria

  
[View profile](https://hashnode.com/@MohammedDhiya)

A software engineering student

I'm a 5th-year computer science student at ESI Algiers. I'm a software engineer working as a web and mobile developer. Very interested in intelligent system development and machine learning

## Responses 2

Markdown supported · ⌘↵ to post

[Karlo B](https://hashnode.com/@karlo-b)

[Jul 12](https://hashnode.com/posts/usedebounce-in-androids-jetpack-compose/64567eb159cc7abf5cac0448/comment/6a540ba6f0937f816ee4b85c)

Pretty cool, but this is when you need a debounced effect on state change. This won't work if you want to debounce, say, button clicks or generally function calls.

So I took inspiration from your code and created this which would be more in line with Lodash's debounce:

```
@Composable
fun debounced(
    ms: Long,
    coroutineScope: CoroutineScope = rememberCoroutineScope(),
    func: () -> Unit,
): () -> Unit {
    return remember {
        var job: Job? = null

        {
            job?.cancel()

            job = coroutineScope.launch {
                delay(ms.milliseconds)
                func()
            }
        }
    }
}
```

[Romman Sabbir](https://hashnode.com/@rommansabbir)

[Oct 5, 2023](https://hashnode.com/posts/usedebounce-in-androids-jetpack-compose/64567eb159cc7abf5cac0448/comment/651eaaa8acca4db1b04ec339)

Doesn't work the extension function.

[Mohamed Dhyia Eddine](https://hashnode.com/@MohammedDhiya)

[Jul 10, 2025](https://hashnode.com/posts/usedebounce-in-androids-jetpack-compose/64567eb159cc7abf5cac0448/comment/651eaaa8acca4db1b04ec339#reply-68701087b62082054440c40c)

What does not work exactly Can you provide more details !
