Skip to content

set_interval possible somehow? #1132

Answered by Archmonger
slauko asked this question in Question
Aug 16, 2023 · 1 comments · 4 replies
Discussion options

You must be logged in to vote

The most common way of doing this is via a while True loop within your use_effect hook.

import asyncio

from reactpy import component, use_effect


@component
def example():
    @use_effect
    async def periodic_task():
        while True:
            await asyncio.sleep(1)
            do_something()

Replies: 1 comment 4 replies

Comment options

You must be logged in to vote
4 replies
@slauko
Comment options

@Archmonger
Comment options

@slauko
Comment options

@rmorshea
Comment options

Answer selected by Archmonger
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
3 participants